OpenId is vexing me.
I'm trying to add a related UserProfile after a User is created from django_authopenid.
As I currently understand how this module works, it seems that:
User.objects.create_user(form1.cleaned_data['username'], form1.cleaned_data['email'], tmp_pwd)
is only called from 2 methods:
django_authopenid.views.register()
django_authopenid.views.signup()
I search the project I'm working with and I could not find any calls to signup(), nor did I find any attempts to reverse('signup_user'), so I'm not sure how or when signup() is used.
django_authopenid.views.register() is called from django_authopenid.views.signin_success(), however, I don't see where signin_success is called in the project either.
I've also tried to create a test to verify that the UserProfile is created:
class UserTestCase(TestCase):
def test_register_should_create_UserProfile(self):
c = Client()
# I'm skipping account/signin/ because that requires me to visit Google.
response = c.post('account/signin/complete/', {'username': 'john', "email":'[email protected]'})
self.assertEqual(response.status_code, 200)
user = User.objects.get('username'=='john')
self.assertTrue(user.get_profile())
I'm guess that this test is setup incorrectly as well, but that's my best attempt so far. I really don't understand how one is supposed to test OpenId.