If you are using the sqlite database to dummy test , you can in a test case 
class submit the post to sign up form ( and store at database ) and in 
other class retrieve the user created previously and performs the login .

Em terça-feira, 23 de maio de 2017 04:07:29 UTC-3, Akash Tomar escreveu:
>
> class SignUpTest(TestCase):
> def test_createAccount(self):
> my_data = {'username': 'akash.tomar107', 'password': 'akashtomar',"email":"
> akash.tomar...@gmail.com <javascript:>", "confirm_password":"akashtomar", 
> "type_of_user":"1", "first_name":"akash", "last_name":"tomar"}
> response = self.client.post('/signup/', json.dumps(my_data), 
> content_type='application/json')
> self.assertIs(json.loads(response.content)["success"], True)
>
> class LoginTest(TestCase):
> def test_login(self):
> my_data = {'username': 'akash.tomar107', 'password': 'akashtomar'}
> response = self.client.post('/login/', json.dumps(my_data), 
> content_type='application/json')
> # import pdb; pdb.set_trace()
> self.assertIs(json.loads(response.content)["login"], True)
>
>
> I want to be able to use the data created while running SignUpTest in the 
> LoginTest. How do I achieve that? Please help.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7bf8b68e-4a3c-475b-a14a-aa8eaadadc41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to