class GetOrCreateUserTest(TestCase): def setUp(self): self.view = SocialAuthView() def test_create_new_google_user(self): profile = {'email': '*****@*****.**', 'given_name': 'Foo', 'family_name': 'Bar', 'picture': "http://www.foo.com"} self.view.get_or_create_user(profile) self.assertEqual(User.objects.all()[0].email, '*****@*****.**') self.assertIsNotNone(User.objects.all()[0].better) def test_create_new_facebook_user(self): profile = {'id': '123', 'name': 'Foo Bar', 'picture': "http://www.foo.com"} self.view.get_or_create_user(profile) self.assertEqual(User.objects.all()[0].email, '*****@*****.**') self.assertIsNotNone(User.objects.all()[0].better)
def setUp(self): self.view = SocialAuthView()