Hello
I am writing tests and using fixtures. May Test classes inherit from django.test.TestCase
Here is an example :
class Test_MemberSignupView (TestCase):
fixtures = [ToolsLocations.machineST_database] @classmethod def setUpClass(cls): super().setUpClass() cls.c = Client() cls.factory = RequestFactory() cls.dic = acc_pages.new_user_signupdic cuser = User.objects.get(username='contactuser') cls.contact = ContactUser.objects.get(user = cuser) def test_MemberSignupView(self): response = self.c.post('/accounts/signup/', data=self.dic, ) user = CustomUser.objects.get(username='newuser') self.assertEqual(user.email, self.dic['email']) self.assertTrue(user.member.is_role(self.dic['roles'][0])) self.assertTrue(user.member.is_role(self.dic['roles'][1])) self.assertEqual(response.status_code, 302)
Sometimes the test fails with the message django.db.utils.ProgrammingError: (1146, “Table ‘test_main_djangoLudd21.account_emailaddress’ doesn’t exist”).
I am using mysql and when I check in mysql the table does exist in the database but not in the test_database.
The account_emailaddress table is created by the package django_allauth.
I tried to debug the problem and it fails when getting an object with EmailAddress.objects.get().
Any Help would be most welcomed.