Пример #1
0
 def test_contains_correct_email_change_request_count(self):
     change = EmailActivation()
     change.user = self.hugo
     change.save()
     user_settings = create_user_settings(self.hugo)
     self.assertEqual(user_settings['emailChangeRequested'], 1)
     user_settings = create_user_settings(self.hein)
     self.assertEqual(user_settings['emailChangeRequested'], 0)
Пример #2
0
    def test_contains_correct_blocked_users(self):
        user_settings = create_user_settings(self.hans)
        self.assertIn('blockedUsers', user_settings)
        blocked = user_settings['blockedUsers']
        self.assertEqual(len(blocked), 1)
        self.assertIn({'displayName': 'herbert'}, blocked)

        user_settings = create_user_settings(self.herbert)
        self.assertIn('blockedUsers', user_settings)
        blocked = user_settings['blockedUsers']
        self.assertEqual(len(blocked), 0)

        user_settings = create_user_settings(self.hein)
        self.assertIn('blockedUsers', user_settings)
        blocked = user_settings['blockedUsers']
        self.assertEqual(len(blocked), 1)
        self.assertIn({'displayName': 'herbert'}, blocked)
Пример #3
0
    def test_create_user_info_contains_correct_followees(self):
        user_settings = create_user_settings(self.hans)
        self.assertIn('followees', user_settings)
        followees = user_settings['followees']
        self.assertEqual(len(followees), 0)

        user_settings = create_user_settings(self.hugo)
        self.assertIn('followees', user_settings)
        followees = user_settings['followees']
        self.assertEqual(len(followees), 1)
        self.assertIn({'displayName': 'hans'}, followees)

        user_settings = create_user_settings(self.hein)
        self.assertIn('followees', user_settings)
        followees = user_settings['followees']
        self.assertEqual(len(followees), 1)
        self.assertIn({'displayName': 'hans'}, followees)
Пример #4
0
 def test_returns_correct_user_settings_for_logged_in_user(self):
     for u in self.users:
         self.assertTrue(
             self.client.login(username=u.username, password='******'))
         response = self.client.get(reverse('load_user_settings'))
         parsed = json.loads(response.content)
         self.assertEqual(
             parsed['loadUserSettingsResponse']['userSettings'],
             create_user_settings(u))
Пример #5
0
 def test_return_value_validates(self):
     for user in self.users:
         user_settings = create_user_settings(user)
         self.assertTrue(validators['userSettings'].validate(user_settings))