lundi 25 avril 2016

Unit testing not setting values

I create the user with:

self.user = get_user_model().objects.create_user('user_1',
                                                     'user_1@test.com',
                                                     'pass')

Then I run some form stuff just getting a name and then run a form.submit()

When I try to run:

self.assertEqual(self.user.first_name, 'foo')

It says '' != 'foo' which means it didn't set the value correctly.

The code itself that I wrote to save it works but for some reason it doesn't set it here in the unit test. Is there something I am doing wrong?

Aucun commentaire:

Enregistrer un commentaire