def test_index_node_contains_correct_author_group(self):
     for arg, authors in zip(self.foo_arguments, self.arg_authors):
         index_node = create_index_node_for_argument(arg, self.hugo.id)
         self.assertIn('authorGroup', index_node)
         author_group = index_node['authorGroup']
         for user in authors:
             self.assertIn(create_user_info(user), author_group)
 def test_index_node_contains_correct_author_group(self):
     for slot, authors in zip(self.top_slots, self.authors):
         index_node = create_index_node_for_slot(slot)
         self.assertIn('authorGroup', index_node)
         author_group = index_node['authorGroup']
         for user in authors:
             self.assertIn(create_user_info(user), author_group)
Exemple #3
0
 def test_returns_correct_user_info_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']['userInfo'],
                          create_user_info(u))
Exemple #4
0
 def test_with_valid_username_returns_correct_user_info(self):
     for u in self.users:
         response = self.client.get(
             reverse('load_user_info', kwargs=dict(name=u.username)))
         parsed = json.loads(response.content)
         self.assertTrue(view_validators['load_user_info'].validate(parsed))
         user_info = create_user_info(u)
         self.assertEqual(parsed['loadUserInfoResponse']['userInfo'],
                          user_info)
    def setUp(self):
        self.hans = create_user('hans')
        self.hugo = create_user('hugo')

        self.root = get_root_node()
        self.slot1 = create_slot('Wahlprogramm')
        self.root.append_child(self.slot1)
        self.textnode1 = create_textNode('LangerWahlprogrammTitel',
                                         authors=[self.hans])
        self.slot1.append_child(self.textnode1)
        self.slot2 = create_slot('Grundsatzprogramm')
        self.root.append_child(self.slot2)
        self.textnode2 = create_textNode('LangerGrundsatzTitel',
                                         authors=[self.hugo])
        self.slot2.append_child(self.textnode2)
        self.slot3 = create_slot('Organisatorisches')
        self.root.append_child(self.slot3)
        self.textnode31 = create_textNode('Langweilig1', authors=[self.hans])
        self.textnode32 = create_textNode('Langweilig2', authors=[self.hugo])
        self.textnode33 = create_textNode('Langweilig3',
                                          authors=[self.hans, self.hugo])
        self.slot3.append_child(self.textnode31)
        self.slot3.append_child(self.textnode32)
        self.textnode32d = create_textNode('Langweilig2 anders',
                                           authors=[self.hans, self.hugo])
        self.slot3.append_child(self.textnode32d)
        self.textnode32.add_derivate(self.textnode32d)
        create_vote(self.hans, [self.textnode32, self.textnode32d])
        self.slot3.append_child(self.textnode33)
        self.textnode33d = create_textNode('Langweilig3 anders',
                                           authors=[self.hans, self.hugo])
        self.slot3.append_child(self.textnode33d)
        self.textnode33.add_derivate(self.textnode33d)
        create_spam_flag(self.hugo, [self.textnode33d])
        create_vote(self.hans, [self.textnode33])
        self.nodes = [self.textnode31, self.textnode32, self.textnode32d,
                      self.textnode33, self.textnode33d]
        self.authorGroups = [[create_user_info(self.hans)],
                             [create_user_info(self.hugo)],
                             [create_user_info(self.hans),
                              create_user_info(self.hugo)],
                             [create_user_info(self.hans),
                              create_user_info(self.hugo)],
                             [create_user_info(self.hans),
                              create_user_info(self.hugo)]]
        self.follows = [0, 1, 1, 1, 0]
        self.spamFlags = [0, 0, 0, 0, 1]
        self.unFollows = [0, 0, 0, 0, 1]
        self.newFollows = [0, 1, 0, 1, 0]
        self.originGroups = [[], [], ['Organisatorisches.2'], [],
                             ['Organisatorisches.4']]
 def test_create_user_info_contains_correct_description(self):
     for user in self.users:
         user_info = create_user_info(user)
         self.assertEqual(user_info['description'],
                          user.profile.description)
 def test_create_user_info_contains_correct_username(self):
     for user in self.users:
         user_info = create_user_info(user)
         self.assertEqual(user_info['displayName'], user.username)
 def test_create_user_info_validates(self):
     for user in self.users:
         user_info = create_user_info(user)
         self.assertTrue(validators['userInfo'].validate(user_info))