def testArg_subresource_Text(self, mock_get, endpoint, resource_id, subresource): mock_get.return_value.json.return_value = {'version_details': 'foo'} self.assertIsNotNone( api._call_api(endpoint, resource_id, subresource).get('version_details'))
def testArg_resource_id_None(self, mock_get, endpoint, resource_id): mock_get.return_value.json.return_value = { 'count': 100, 'results': ['some', 'reults'] } self.assertIsNotNone(api._call_api(endpoint, resource_id).get('count'))
def testEnv_ErrorResponse(self, mock_get, endpoint, resource_id): mock_get.return_value.raise_for_status.side_effect = HTTPError() with self.assertRaises(HTTPError): api._call_api(endpoint, resource_id)
def testArg_endpoint_Text(self, endpoint, resource_id): with self.assertRaises(ValueError): api._call_api(endpoint, resource_id)
def testArgs(self, mock_get, endpoint, resource_id): mock_get.return_value.json.return_value = {'id': resource_id} self.assertEqual( api._call_api(endpoint, resource_id)['id'], resource_id)