renamed rbd_iscsi_client to client
This fixes the py27 build failures. Cleaned up pep8 violations
This commit is contained in:
parent
d74953c1b8
commit
d26ee89df6
@ -1,3 +1,5 @@
|
|||||||
CHANGES
|
CHANGES
|
||||||
=======
|
=======
|
||||||
|
|
||||||
|
* Added basic unit tests
|
||||||
|
* Initial commit
|
||||||
|
@ -1,5 +1,15 @@
|
|||||||
#!/usr/bin/env python
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# -*- coding: utf-8 -*-
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
#
|
#
|
||||||
# rbd_iscsi_client documentation build configuration file, created by
|
# rbd_iscsi_client documentation build configuration file, created by
|
||||||
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
|
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
|
||||||
@ -18,11 +28,6 @@
|
|||||||
# relative to the documentation root, use os.path.abspath to make it
|
# relative to the documentation root, use os.path.abspath to make it
|
||||||
# absolute, like shown here.
|
# absolute, like shown here.
|
||||||
#
|
#
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
sys.path.insert(0, os.path.abspath('..'))
|
|
||||||
|
|
||||||
import rbd_iscsi_client
|
|
||||||
|
|
||||||
# -- General configuration ---------------------------------------------
|
# -- General configuration ---------------------------------------------
|
||||||
|
|
||||||
@ -59,9 +64,6 @@ author = u"Walter A. Boring IV"
|
|||||||
# the built documents.
|
# the built documents.
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = rbd_iscsi_client.__version__
|
|
||||||
# The full version, including alpha/beta/rc tags.
|
|
||||||
release = rbd_iscsi_client.__version__
|
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
@ -101,7 +103,7 @@ html_theme = 'openstackdocs'
|
|||||||
# Add any paths that contain custom static files (such as style sheets) here,
|
# Add any paths that contain custom static files (such as style sheets) here,
|
||||||
# relative to this directory. They are copied after the builtin static files,
|
# relative to this directory. They are copied after the builtin static files,
|
||||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||||
html_static_path = ['_static']
|
#html_static_path = ['_static']
|
||||||
|
|
||||||
|
|
||||||
# -- Options for HTMLHelp output ---------------------------------------
|
# -- Options for HTMLHelp output ---------------------------------------
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License."""
|
# under the License.
|
||||||
"""
|
"""
|
||||||
Exceptions for the client
|
Exceptions for the client
|
||||||
|
|
||||||
@ -30,9 +30,7 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class UnsupportedVersion(Exception):
|
class UnsupportedVersion(Exception):
|
||||||
"""
|
"""unsupported version of the API."""
|
||||||
Indicates that the user is trying to use an unsupported version of the API
|
|
||||||
"""
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@ -49,8 +47,7 @@ class NoUniqueMatch(Exception):
|
|||||||
|
|
||||||
|
|
||||||
class ClientException(Exception):
|
class ClientException(Exception):
|
||||||
"""
|
"""The base exception class for all exceptions this library raises.
|
||||||
The base exception class for all exceptions this library raises.
|
|
||||||
|
|
||||||
:param error: The error array
|
:param error: The error array
|
||||||
:type error: array
|
:type error: array
|
||||||
@ -117,9 +114,7 @@ class ClientException(Exception):
|
|||||||
|
|
||||||
|
|
||||||
class SSLCertFailed(ClientException):
|
class SSLCertFailed(ClientException):
|
||||||
"""
|
"""The SSL certificate from the server could not be verified."""
|
||||||
The SSL certificate from the server could not be verified
|
|
||||||
"""
|
|
||||||
http_status = ""
|
http_status = ""
|
||||||
message = "SSL Certificate Verification Failed"
|
message = "SSL Certificate Verification Failed"
|
||||||
|
|
||||||
@ -128,44 +123,32 @@ class SSLCertFailed(ClientException):
|
|||||||
|
|
||||||
|
|
||||||
class RequestException(ClientException):
|
class RequestException(ClientException):
|
||||||
"""
|
"""There was an ambiguous exception that occurred in Requests."""
|
||||||
There was an ambiguous exception that occurred in Requests
|
|
||||||
"""
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ConnectionError(ClientException):
|
class ConnectionError(ClientException):
|
||||||
"""
|
"""There was an error connecting to the server."""
|
||||||
There was an error connecting to the server
|
|
||||||
"""
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class HTTPError(ClientException):
|
class HTTPError(ClientException):
|
||||||
"""
|
"""An HTTP error occurred."""
|
||||||
An HTTP error occurred
|
|
||||||
"""
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class URLRequired(ClientException):
|
class URLRequired(ClientException):
|
||||||
"""
|
"""A valid URL is required to make a request."""
|
||||||
A valid URL is required to make a request
|
|
||||||
"""
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TooManyRedirects(ClientException):
|
class TooManyRedirects(ClientException):
|
||||||
"""
|
"""Too many redirects."""
|
||||||
Too many redirects
|
|
||||||
"""
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Timeout(ClientException):
|
class Timeout(ClientException):
|
||||||
"""
|
"""The request timed out."""
|
||||||
The request timed out
|
|
||||||
"""
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@ -173,81 +156,63 @@ class Timeout(ClientException):
|
|||||||
|
|
||||||
|
|
||||||
class HTTPBadRequest(ClientException):
|
class HTTPBadRequest(ClientException):
|
||||||
"""
|
"""HTTP 400 - Bad request: you sent some malformed data."""
|
||||||
HTTP 400 - Bad request: you sent some malformed data.
|
|
||||||
"""
|
|
||||||
http_status = 400
|
http_status = 400
|
||||||
message = "Bad request"
|
message = "Bad request"
|
||||||
|
|
||||||
|
|
||||||
class HTTPUnauthorized(ClientException):
|
class HTTPUnauthorized(ClientException):
|
||||||
"""
|
"""HTTP 401 - Unauthorized: bad credentials."""
|
||||||
HTTP 401 - Unauthorized: bad credentials.
|
|
||||||
"""
|
|
||||||
http_status = 401
|
http_status = 401
|
||||||
message = "Unauthorized"
|
message = "Unauthorized"
|
||||||
|
|
||||||
|
|
||||||
class HTTPForbidden(ClientException):
|
class HTTPForbidden(ClientException):
|
||||||
"""
|
"""HTTP 403 - Forbidden: credentials don't give access to this resource."""
|
||||||
HTTP 403 - Forbidden: your credentials don't give you access to this
|
|
||||||
resource.
|
|
||||||
"""
|
|
||||||
http_status = 403
|
http_status = 403
|
||||||
message = "Forbidden"
|
message = "Forbidden"
|
||||||
|
|
||||||
|
|
||||||
class HTTPNotFound(ClientException):
|
class HTTPNotFound(ClientException):
|
||||||
"""
|
"""HTTP 404 - Not found """
|
||||||
HTTP 404 - Not found
|
|
||||||
"""
|
|
||||||
http_status = 404
|
http_status = 404
|
||||||
message = "Not found"
|
message = "Not found"
|
||||||
|
|
||||||
|
|
||||||
class HTTPMethodNotAllowed(ClientException):
|
class HTTPMethodNotAllowed(ClientException):
|
||||||
"""
|
"""HTTP 405 - Method not Allowed """
|
||||||
HTTP 405 - Method not Allowed
|
|
||||||
"""
|
|
||||||
http_status = 405
|
http_status = 405
|
||||||
message = "Method Not Allowed"
|
message = "Method Not Allowed"
|
||||||
|
|
||||||
|
|
||||||
class HTTPNotAcceptable(ClientException):
|
class HTTPNotAcceptable(ClientException):
|
||||||
"""
|
"""HTTP 406 - Method not Acceptable """
|
||||||
HTTP 406 - Method not Acceptable
|
|
||||||
"""
|
|
||||||
http_status = 406
|
http_status = 406
|
||||||
message = "Method Not Acceptable"
|
message = "Method Not Acceptable"
|
||||||
|
|
||||||
|
|
||||||
class HTTPProxyAuthRequired(ClientException):
|
class HTTPProxyAuthRequired(ClientException):
|
||||||
"""
|
"""HTTP 407 - The client must first authenticate itself with the proxy."""
|
||||||
HTTP 407 - The client must first authenticate itself with the proxy.
|
|
||||||
"""
|
|
||||||
http_status = 407
|
http_status = 407
|
||||||
message = "Proxy Authentication Required"
|
message = "Proxy Authentication Required"
|
||||||
|
|
||||||
|
|
||||||
class HTTPRequestTimeout(ClientException):
|
class HTTPRequestTimeout(ClientException):
|
||||||
"""
|
"""HTTP 408 - The server timed out waiting for the request."""
|
||||||
HTTP 408 - The server timed out waiting for the request.
|
|
||||||
"""
|
|
||||||
http_status = 408
|
http_status = 408
|
||||||
message = "Request Timeout"
|
message = "Request Timeout"
|
||||||
|
|
||||||
|
|
||||||
class HTTPConflict(ClientException):
|
class HTTPConflict(ClientException):
|
||||||
"""
|
"""HTTP 409 - Conflict: A Conflict happened on the server."""
|
||||||
HTTP 409 - Conflict: A Conflict happened on the server
|
|
||||||
"""
|
|
||||||
http_status = 409
|
http_status = 409
|
||||||
message = "Conflict"
|
message = "Conflict"
|
||||||
|
|
||||||
|
|
||||||
class HTTPGone(ClientException):
|
class HTTPGone(ClientException):
|
||||||
"""
|
"""HTTP 410
|
||||||
HTTP 410 - Indicates that the resource requested is no longer available and
|
|
||||||
|
Indicates that the resource requested is no longer available and
|
||||||
will not be available again.
|
will not be available again.
|
||||||
"""
|
"""
|
||||||
http_status = 410
|
http_status = 410
|
||||||
@ -255,17 +220,20 @@ class HTTPGone(ClientException):
|
|||||||
|
|
||||||
|
|
||||||
class HTTPLengthRequired(ClientException):
|
class HTTPLengthRequired(ClientException):
|
||||||
"""
|
"""HTTP 411
|
||||||
HTTP 411 - The request did not specify the length of its content, which is
|
|
||||||
|
The request did not specify the length of its content, which is
|
||||||
required by the requested resource.
|
required by the requested resource.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
http_status = 411
|
http_status = 411
|
||||||
message = "Length Required"
|
message = "Length Required"
|
||||||
|
|
||||||
|
|
||||||
class HTTPPreconditionFailed(ClientException):
|
class HTTPPreconditionFailed(ClientException):
|
||||||
"""
|
"""HTTP 412
|
||||||
HTTP 412 - The server does not meet one of the preconditions that the
|
|
||||||
|
The server does not meet one of the preconditions that the
|
||||||
requester put on the request.
|
requester put on the request.
|
||||||
"""
|
"""
|
||||||
http_status = 412
|
http_status = 412
|
||||||
@ -273,53 +241,54 @@ class HTTPPreconditionFailed(ClientException):
|
|||||||
|
|
||||||
|
|
||||||
class HTTPRequestEntityTooLarge(ClientException):
|
class HTTPRequestEntityTooLarge(ClientException):
|
||||||
"""
|
"""HTTP 413
|
||||||
HTTP 413 - The request is larger than the server is willing or able to
|
|
||||||
process
|
The request is larger than the server is willing or able to process
|
||||||
"""
|
"""
|
||||||
http_status = 413
|
http_status = 413
|
||||||
message = "Request Entity Too Large"
|
message = "Request Entity Too Large"
|
||||||
|
|
||||||
|
|
||||||
class HTTPRequestURITooLong(ClientException):
|
class HTTPRequestURITooLong(ClientException):
|
||||||
"""
|
"""HTTP 414 - The URI provided was too long for the server to process."""
|
||||||
HTTP 414 - The URI provided was too long for the server to process.
|
|
||||||
"""
|
|
||||||
http_status = 414
|
http_status = 414
|
||||||
message = "Request URI Too Large"
|
message = "Request URI Too Large"
|
||||||
|
|
||||||
|
|
||||||
class HTTPUnsupportedMediaType(ClientException):
|
class HTTPUnsupportedMediaType(ClientException):
|
||||||
"""
|
"""HTTP 415
|
||||||
HTTP 415 - The request entity has a media type which the server or resource
|
|
||||||
|
The request entity has a media type which the server or resource
|
||||||
does not support.
|
does not support.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
http_status = 415
|
http_status = 415
|
||||||
message = "Unsupported Media Type"
|
message = "Unsupported Media Type"
|
||||||
|
|
||||||
|
|
||||||
class HTTPRequestedRangeNotSatisfiable(ClientException):
|
class HTTPRequestedRangeNotSatisfiable(ClientException):
|
||||||
"""
|
"""HTTP 416
|
||||||
HTTP 416 - The client has asked for a portion of the file, but the server
|
|
||||||
cannot supply that portion.
|
The client has asked for a portion of the file, but the server cannot
|
||||||
|
supply that portion.
|
||||||
"""
|
"""
|
||||||
http_status = 416
|
http_status = 416
|
||||||
message = "Requested Range Not Satisfiable"
|
message = "Requested Range Not Satisfiable"
|
||||||
|
|
||||||
|
|
||||||
class HTTPExpectationFailed(ClientException):
|
class HTTPExpectationFailed(ClientException):
|
||||||
"""
|
"""HTTP 417
|
||||||
HTTP 417 - The server cannot meet the requirements of the Expect
|
|
||||||
|
The server cannot meet the requirements of the Expect
|
||||||
request-header field.
|
request-header field.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
http_status = 417
|
http_status = 417
|
||||||
message = "Expectation Failed"
|
message = "Expectation Failed"
|
||||||
|
|
||||||
|
|
||||||
class HTTPTeaPot(ClientException):
|
class HTTPTeaPot(ClientException):
|
||||||
"""
|
"""HTTP 418 - I'm a Tea Pot."""
|
||||||
HTTP 418 - I'm a Tea Pot
|
|
||||||
"""
|
|
||||||
http_status = 418
|
http_status = 418
|
||||||
message = "I'm A Teapot. (RFC 2324)"
|
message = "I'm A Teapot. (RFC 2324)"
|
||||||
|
|
||||||
@ -328,24 +297,21 @@ class HTTPTeaPot(ClientException):
|
|||||||
|
|
||||||
|
|
||||||
class HTTPInternalServerError(ClientException):
|
class HTTPInternalServerError(ClientException):
|
||||||
"""
|
"""HTTP 500 - Internal Server Error: an internal error occured."""
|
||||||
HTTP 500 - Internal Server Error: an internal error occured.
|
|
||||||
"""
|
|
||||||
http_status = 500
|
http_status = 500
|
||||||
message = "Internal Server Error"
|
message = "Internal Server Error"
|
||||||
|
|
||||||
|
|
||||||
class HTTPNotImplemented(ClientException):
|
class HTTPNotImplemented(ClientException):
|
||||||
"""
|
"""HTTP 501 - Not Implemented: server does not support the operation."""
|
||||||
HTTP 501 - Not Implemented: the server does not support this operation.
|
|
||||||
"""
|
|
||||||
http_status = 501
|
http_status = 501
|
||||||
message = "Not Implemented"
|
message = "Not Implemented"
|
||||||
|
|
||||||
|
|
||||||
class HTTPBadGateway(ClientException):
|
class HTTPBadGateway(ClientException):
|
||||||
"""
|
"""HTTP 502
|
||||||
HTTP 502 - The server was acting as a gateway or proxy and received an
|
|
||||||
|
The server was acting as a gateway or proxy and received an
|
||||||
invalid response from the upstream server.
|
invalid response from the upstream server.
|
||||||
"""
|
"""
|
||||||
http_status = 502
|
http_status = 502
|
||||||
@ -353,16 +319,15 @@ class HTTPBadGateway(ClientException):
|
|||||||
|
|
||||||
|
|
||||||
class HTTPServiceUnavailable(ClientException):
|
class HTTPServiceUnavailable(ClientException):
|
||||||
"""
|
"""HTTP 503 - The server is currently unavailable."""
|
||||||
HTTP 503 - The server is currently unavailable
|
|
||||||
"""
|
|
||||||
http_status = 503
|
http_status = 503
|
||||||
message = "Service Unavailable"
|
message = "Service Unavailable"
|
||||||
|
|
||||||
|
|
||||||
class HTTPGatewayTimeout(ClientException):
|
class HTTPGatewayTimeout(ClientException):
|
||||||
"""
|
"""HTTP 504
|
||||||
HTTP 504 - The server was acting as a gateway or proxy and did
|
|
||||||
|
The server was acting as a gateway or proxy and did
|
||||||
not receive a timely response from the upstream server.
|
not receive a timely response from the upstream server.
|
||||||
"""
|
"""
|
||||||
http_status = 504
|
http_status = 504
|
||||||
@ -370,9 +335,9 @@ class HTTPGatewayTimeout(ClientException):
|
|||||||
|
|
||||||
|
|
||||||
class HTTPVersionNotSupported(ClientException):
|
class HTTPVersionNotSupported(ClientException):
|
||||||
"""
|
"""HTTP 505
|
||||||
HTTP 505 - The server does not support the HTTP protocol version used
|
|
||||||
in the request.
|
The server does not support the HTTP protocol version used in the request.
|
||||||
"""
|
"""
|
||||||
http_status = 505
|
http_status = 505
|
||||||
message = "Version Not Supported"
|
message = "Version Not Supported"
|
||||||
@ -399,8 +364,8 @@ _code_map = dict((c.http_status, c) for c in
|
|||||||
|
|
||||||
|
|
||||||
def from_response(response, body):
|
def from_response(response, body):
|
||||||
"""
|
"""Return an instance of an ClientException or subclass.
|
||||||
Return an instance of an ClientException or subclass
|
|
||||||
based on a Python Requests response.
|
based on a Python Requests response.
|
||||||
|
|
||||||
Usage::
|
Usage::
|
||||||
|
38
rbd_iscsi_client/tests/test_client.py
Normal file
38
rbd_iscsi_client/tests/test_client.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
"""Tests for `rbd_iscsi_client` package."""
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from rbd_iscsi_client import client
|
||||||
|
|
||||||
|
|
||||||
|
class TestRbd_iscsi_client(unittest.TestCase):
|
||||||
|
"""Tests for `rbd_iscsi_client` package."""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
"""Set up test fixtures, if any."""
|
||||||
|
fake_url = 'client://fake-url:0000'
|
||||||
|
fake_user = 'user'
|
||||||
|
fake_password = 'password'
|
||||||
|
self.client = client.RBDISCSIClient(fake_user, fake_password,
|
||||||
|
fake_url, secure=False,
|
||||||
|
http_log_debug=True,
|
||||||
|
suppress_ssl_warnings=False,
|
||||||
|
timeout=10)
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
"""Tear down test fixtures, if any."""
|
||||||
|
|
||||||
|
def test_000_something(self):
|
||||||
|
"""Test something."""
|
@ -1,13 +1,21 @@
|
|||||||
#!/usr/bin/env python
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# -*- coding: utf-8 -*-
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
"""Tests for `rbd_iscsi_client` package."""
|
"""Tests for `rbd_iscsi_client` package."""
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
import requests
|
import requests
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from rbd_iscsi_client import rbd_iscsi_client as client
|
from rbd_iscsi_client import client
|
||||||
from rbd_iscsi_client import exceptions
|
from rbd_iscsi_client import exceptions
|
||||||
|
|
||||||
|
|
||||||
@ -30,7 +38,6 @@ class TestRbd_iscsi_client(unittest.TestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.client = None
|
self.client = None
|
||||||
|
|
||||||
|
|
||||||
def test_request_timeout(self):
|
def test_request_timeout(self):
|
||||||
self.client._http_log_req = mock.Mock()
|
self.client._http_log_req = mock.Mock()
|
||||||
self.client.timeout = 10
|
self.client.timeout = 10
|
@ -1,9 +1,16 @@
|
|||||||
#!/usr/bin/env python
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# -*- coding: utf-8 -*-
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
"""Tests for `rbd_iscsi_client` package."""
|
"""Tests for `rbd_iscsi_client` package."""
|
||||||
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from rbd_iscsi_client import exceptions
|
from rbd_iscsi_client import exceptions
|
||||||
@ -25,7 +32,7 @@ class Test_exceptions(unittest.TestCase):
|
|||||||
|
|
||||||
fake_response = FakeResponse()
|
fake_response = FakeResponse()
|
||||||
output = exceptions.from_response(fake_response, {}).__str__()
|
output = exceptions.from_response(fake_response, {}).__str__()
|
||||||
self.assertEquals('Internal Server Error (HTTP 500)', output)
|
self.assertEqual('Internal Server Error (HTTP 500)', output)
|
||||||
|
|
||||||
def test_001_client_exception_string_format(self):
|
def test_001_client_exception_string_format(self):
|
||||||
fake_error = {'code': 999,
|
fake_error = {'code': 999,
|
||||||
@ -38,6 +45,6 @@ class Test_exceptions(unittest.TestCase):
|
|||||||
client_ex.http_status = 500
|
client_ex.http_status = 500
|
||||||
output = client_ex.__str__()
|
output = client_ex.__str__()
|
||||||
|
|
||||||
self.assertEquals("Fake Error (HTTP 500) 999 - Fake Description - "
|
self.assertEqual("Fake Error (HTTP 500) 999 - Fake Description - "
|
||||||
"Fake Ref (1: 'Fake Debug 1') (2: 'Fake Debug 2')",
|
"Fake Ref (1: 'Fake Debug 1') (2: 'Fake Debug 2')",
|
||||||
output)
|
output)
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""Tests for `rbd_iscsi_client` package."""
|
|
||||||
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
from rbd_iscsi_client import rbd_iscsi_client
|
|
||||||
|
|
||||||
|
|
||||||
class TestRbd_iscsi_client(unittest.TestCase):
|
|
||||||
"""Tests for `rbd_iscsi_client` package."""
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
"""Set up test fixtures, if any."""
|
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
"""Tear down test fixtures, if any."""
|
|
||||||
|
|
||||||
def test_000_something(self):
|
|
||||||
"""Test something."""
|
|
Loading…
Reference in New Issue
Block a user