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']))
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']))
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']))