Esempio n. 1
0
 def test_add_storage_invalid_with_status_code_401(self, mock_request_http):
     mock_request_http.return_value = True, 401
     with self.assertRaises(UnauthorizedError) as context:
         Storage().add(**self.storage_data_create)
     self.assertTrue(context.exception.__class__.__name__, 'UnauthorizedError')
Esempio n. 2
0
 def test_add_storage_invalid_with_status_code_5xx(self, mock_request_http):
     mock_request_http.return_value = True, 512
     with self.assertRaises(ServerError) as context:
         Storage().add(**self.storage_data_create)
     self.assertTrue(context.exception.__class__.__name__, 'ServerError')
Esempio n. 3
0
 def test_delete_storage_invalid(self, mock_request_http):
     mock_request_http.return_value = True, 200
     with self.assertRaises(ClientException) as context:
         Storage().delete(id=self.storage_id)
     self.assertTrue(context.exception.__class__.__name__, 'ClientException')
Esempio n. 4
0
 def test_add_storage_valid(self, mock_request_http):
     mock_request_http.return_value = True, 200
     data = Storage().add(**self.storage_data_create)
     self.assertEqual(data[1], 200)
Esempio n. 5
0
 def test_remove_storage_invalid_with_status_code_4xx(self, mock_request_http):
     mock_request_http.return_value = True, 412
     with self.assertRaises(ClientError) as context:
         Storage().remove(id=self.storage_id)
     self.assertTrue(context.exception.__class__.__name__, 'ClientError')
Esempio n. 6
0
 def test_remove_storage_invalid(self, mock_request_http):
     mock_request_http.return_value = True, 200
     with self.assertRaises(TypeError) as context:
         Storage().remove()
     self.assertTrue(context.exception.__class__.__name__, 'TypeError')
Esempio n. 7
0
 def test_remove_storage_invalid_with_status_code_503(self, mock_request_http):
     mock_request_http.return_value = True, 503
     with self.assertRaises(ServiceUnavailableError) as context:
         Storage().remove(id=self.storage_id)
     self.assertTrue(context.exception.__class__.__name__, 'ServiceUnavailableError')
Esempio n. 8
0
 def test_remove_storage_invalid_with_status_code_500(self, mock_request_http):
     mock_request_http.return_value = True, 500
     with self.assertRaises(InternalServerError) as context:
         Storage().remove(id=self.storage_id)
     self.assertTrue(context.exception.__class__.__name__, 'InternalServerError')
Esempio n. 9
0
 def test_remove_storage_valid(self, mock_request_http):
     mock_request_http.return_value = True, 200
     data = Storage().remove(id=self.storage_id)
     self.assertEqual(data[1], 200)
Esempio n. 10
0
 def test_update_storage_invalid_with_status_code_422(self, mock_request_http):
     mock_request_http.return_value = True, 422
     with self.assertRaises(UnprocessableError) as context:
         Storage().update(**self.storage_data_update)
     self.assertTrue(context.exception.__class__.__name__, 'UnprocessableError')
Esempio n. 11
0
 def test_retrieve_storage_invalid_with_status_code_404(self, mock_request_http):
     mock_request_http.return_value = True, 404
     with self.assertRaises(NotFoundError) as context:
         Storage().retrieve(id=self.storage_id)
     self.assertTrue(context.exception.__class__.__name__, 'NotFoundError')