def test_mozillian_username_exists(self, mocked_is_vouched): """Test that if an Anonymous Mozillians changes his settings in the mozillians.org, we update his username on our portal. """ mozillian = UserFactory.create(groups=['Mozillians']) mocked_is_vouched.return_value = {'is_vouched': True, 'email': mozillian.email, 'username': '******', 'full_name': 'Awesome Mozillian'} check_mozillian_username.apply() user = User.objects.get(email=mozillian.email) eq_(user.userprofile.mozillian_username, u'Mozillian') eq_(user.get_full_name(), u'Awesome Mozillian')
def test_mozillian_username_missing(self, mocked_lookup): """Test that if a Mozillian changes his settings in the mozillians.org, we update his username on our portal. """ mozillian = UserFactory.create( groups=['Mozillians'], first_name='Awesome', last_name='Mozillian', userprofile__mozillian_username='******') mocked_lookup.return_value = { 'is_vouched': True, 'email': mozillian.email, 'username': '******', 'full_name': { 'privacy': 'Mozillians', 'value': 'Awesome Mozillian' } } check_mozillian_username.apply() user = User.objects.get(email=mozillian.email) eq_(user.userprofile.mozillian_username, '') eq_(user.get_full_name(), u'Anonymous Mozillian')