示例#1
0
 def test_add_user(self):
     request = create_request_with_api_token_header(
         json_body=self.test_body)
     response: Response = apiviews.ApiUser(request).collection_post()
     print(response)
     self.assertIsInstance(response, dict)
     self.assertIn('id', response)
示例#2
0
 def test_single_user(self):
     tobias_krauthoff = {'id': 2, 'nickname': 'Tobias'}
     response = apiviews.ApiUser(
         construct_dummy_request(matchdict={'id': 2})).get()
     self.assertUser(response)
     self.assertDictEqual(response, tobias_krauthoff)
示例#3
0
 def test_list_users(self):
     response = apiviews.ApiUser(construct_dummy_request()).collection_get()
     self.assertIsInstance(response, list)
     for user in response:
         self.assertUser(user)
示例#4
0
 def test_add_user_with_user_token(self):
     request = create_request_with_token_header(json_body=self.test_body)
     response: Response = apiviews.ApiUser(request).collection_post()
     self.assertGreaterEqual(response.status_code, 400)