コード例 #1
0
    def testAdminGetList(self):
        """Admin retrieves list of all users."""

        user_count = 10
        test_utils.CreateUsers(user_count)

        with self.LoggedInUser(admin=True):
            response = self.testapp.get('')

        output = response.json

        self.assertIn('application/json', response.headers['Content-type'])
        self.assertIsInstance(output, dict)
        self.assertEqual(user_count, len(output['content']))
コード例 #2
0
    def testAdminGetQuery(self):
        """Admin queries a user."""
        params = {'search': 1, 'searchBase': 'voteWeight'}

        user_count = 10
        test_utils.CreateUsers(user_count)

        with self.LoggedInUser(admin=True):
            response = self.testapp.get('', params)

        output = response.json

        self.assertIn('application/json', response.headers['Content-type'])
        self.assertIsInstance(output, dict)
        self.assertEqual(user_count, len(output['content']))
コード例 #3
0
    def testAdminGetListPlatformNoEffect(self):
        """Admin specifies a platform which has no effect on the results."""
        params = {'platform': 'santa'}

        user_count = 10
        test_utils.CreateUsers(user_count)

        with self.LoggedInUser(admin=True):
            response = self.testapp.get('', params)

        output = response.json

        self.assertIn('application/json', response.headers['Content-type'])
        self.assertIsInstance(output, dict)
        self.assertEqual(user_count, len(output['content']))