Rename the project from "hnv" to "hnvclient"

Change-Id: I0ea1f5abe9eb636ac264372ad6f4367814316eda
This commit is contained in:
Alexandru Coman 2017-03-27 15:58:44 +03:00
parent e742e53b5c
commit b577feb7e7
No known key found for this signature in database
GPG Key ID: A7B6A9021F704507
48 changed files with 69 additions and 70 deletions

View File

@ -1,6 +1,6 @@
[run]
branch = True
source = hnv
source = hnvclient
[report]
ignore_errors = True

View File

@ -21,7 +21,7 @@ The Python interface matches the underlying REST API and can be employed in 3rd
.. code:: python
>>> from hnv import client
>>> from hnvclient import client
>>> logical_networks = client.LogicalNetworks.get()
>>> for logical_network in logical_networks:
... print(logical_network.resource_id)
@ -32,11 +32,11 @@ The Python interface matches the underlying REST API and can be employed in 3rd
>>> logical_network = client.LogicalNetworks.get(resource_id="cd804db3-df59-4f57-8a7d-11cc3f3c4d98")
>>> logical_network
<hnv.client.LogicalNetworks object at 0x7fcd79419910>
<hnvclient.client.LogicalNetworks object at 0x7fcd79419910>
>>> logical_network.provisioning_state
u'Succeeded'
>>> logical_network.subnetworks
[<hnv.client.LogicalSubnetworks object at 0x7fcd79419150>]
[<hnvclient.client.LogicalSubnetworks object at 0x7fcd79419150>]
>>> logical_network.subnetworks[0].resource_id
u'4390e3d8-c527-4534-882f-906c47ffd0bb'
@ -47,8 +47,7 @@ The Python interface matches the underlying REST API and can be employed in 3rd
import json
import sys
from hnv import config
from hnv import client
from hnvclient import client
def view_logical_networks():
@ -95,7 +94,7 @@ The Python interface matches the underlying REST API and can be employed in 3rd
def main():
"""Logical networks sample entry point."""
config.CONFIG(sys.argv[1:])
client.setup()
view_logical_networks()
create_virtual_network()
view_logical_networks()

View File

@ -1,7 +1,7 @@
HNV Client
==========
.. automodule:: hnv.client
.. automodule:: hnvclient.client
:members:
:inherited-members:
.. autoattribute::

View File

@ -1,6 +1,6 @@
HNV Client's exceptions
=======================
.. automodule:: hnv.common.exception
.. automodule:: hnvclient.common.exception
:members:
.. autoattribute::

View File

@ -4,4 +4,4 @@ Usage
To use python-hnvclient in a project::
import hnv
import hnvclient

View File

@ -14,7 +14,7 @@ import pbr.version
__version__ = pbr.version.VersionInfo(
'hnv').version_string()
'hnvclient').version_string()
CONFIG = {
"url": None,

View File

@ -20,11 +20,11 @@ import uuid
from oslo_log import log as logging
from hnv.common import constant
from hnv.common import exception
from hnv.common import model
from hnv.common import utils
from hnv import CONFIG
from hnvclient.common import constant
from hnvclient.common import exception
from hnvclient.common import model
from hnvclient.common import utils
from hnvclient import CONFIG
LOG = logging.getLogger(__name__)

View File

@ -21,7 +21,7 @@ import copy
from oslo_log import log as logging
import six
from hnv.common import exception
from hnvclient.common import exception
LOG = logging.getLogger(__name__)

View File

@ -23,9 +23,9 @@ import requests
import requests_ntlm
import six
from hnv.common import constant
from hnv.common import exception
from hnv import CONFIG
from hnvclient.common import constant
from hnvclient.common import exception
from hnvclient import CONFIG
LOG = logging.getLogger(__name__)

View File

@ -21,8 +21,8 @@ try:
except ImportError:
import mock
from hnv.common import exception
from hnv.common import model
from hnvclient.common import exception
from hnvclient.common import model
class TestFieldDescriptor(unittest.TestCase):
@ -80,7 +80,7 @@ class TestField(unittest.TestCase):
self.assertIs(field.is_property, mock.sentinel.is_property)
self.assertIs(field.is_read_only, mock.sentinel.is_read_only)
@mock.patch("hnv.common.model._FieldDescriptor")
@mock.patch("hnvclient.common.model._FieldDescriptor")
def test_add_to_class(self, mock_field_descriptor):
field = model.Field(name="test_add_to_class", key="test")
model_class = mock.Mock()
@ -101,7 +101,7 @@ class TestModelOptions(unittest.TestCase):
self.assertEqual(model_options._name, mock.sentinel.cls.name)
@mock.patch("six.callable")
@mock.patch("hnv.common.model._ModelOptions.remove_field")
@mock.patch("hnvclient.common.model._ModelOptions.remove_field")
def _test_add_field(self, mock_remove_field, mock_callable,
callable_default):
model_options = model._ModelOptions(self.__class__)

View File

@ -22,11 +22,11 @@ except ImportError:
import requests
from hnv.common import constant
from hnv.common import exception
from hnv.common import utils as hnv_utils
from hnv import CONFIG
from hnv.tests import utils as test_utils
from hnvclient.common import constant
from hnvclient.common import exception
from hnvclient.common import utils as hnv_utils
from hnvclient import CONFIG
from hnvclient.tests import utils as test_utils
class TestHNVClient(unittest.TestCase):
@ -39,8 +39,8 @@ class TestHNVClient(unittest.TestCase):
return hnv_utils._HNVClient(url, username, password, allow_insecure,
ca_bundle)
@mock.patch("hnv.common.utils._HNVClient._get_headers")
@mock.patch("hnv.common.utils._HNVClient._verify_https_request")
@mock.patch("hnvclient.common.utils._HNVClient._get_headers")
@mock.patch("hnvclient.common.utils._HNVClient._verify_https_request")
@mock.patch("requests_ntlm.HttpNtlmAuth")
@mock.patch("requests.Session")
def test_session(self, mock_get_session, mock_auth, mock_verify,
@ -73,8 +73,8 @@ class TestHNVClient(unittest.TestCase):
@mock.patch("time.sleep")
@mock.patch("json.dumps")
@mock.patch("requests.compat.urljoin")
@mock.patch("hnv.common.utils._HNVClient._session")
@mock.patch("hnv.common.utils._HNVClient._get_headers")
@mock.patch("hnvclient.common.utils._HNVClient._session")
@mock.patch("hnvclient.common.utils._HNVClient._get_headers")
def _test_http_request(self, mock_headers, mock_session, mock_join,
mock_dump, mock_sleep,
method, body, response, status_code, if_match):
@ -99,7 +99,7 @@ class TestHNVClient(unittest.TestCase):
{"status_code": status_code})
client = self._get_client()
with test_utils.LogSnatcher("hnv.common.utils") as logging:
with test_utils.LogSnatcher("hnvclient.common.utils") as logging:
if isinstance(expected_response, requests.exceptions.SSLError):
self.assertRaises(exception.CertificateVerifyFailed,
client._http_request,
@ -218,7 +218,7 @@ class TestHNVClient(unittest.TestCase):
status_code=500,
if_match=False)
@mock.patch("hnv.common.utils._HNVClient._http_request")
@mock.patch("hnvclient.common.utils._HNVClient._http_request")
def test_get_resource(self, mock_http_request):
response = mock.Mock()
response.json = mock.Mock()
@ -233,7 +233,7 @@ class TestHNVClient(unittest.TestCase):
self.assertRaises(exception.ServiceException,
client.get_resource, mock.sentinel.path)
@mock.patch("hnv.common.utils._HNVClient._http_request")
@mock.patch("hnvclient.common.utils._HNVClient._http_request")
def test_update_resource(self, mock_http_request):
response = mock.Mock()
response.json = mock.Mock()
@ -252,7 +252,7 @@ class TestHNVClient(unittest.TestCase):
client.update_resource,
mock.sentinel.path, mock.sentinel.data)
@mock.patch("hnv.common.utils._HNVClient._http_request")
@mock.patch("hnvclient.common.utils._HNVClient._http_request")
def test_remove_resource(self, mock_http_request):
mock_http_request.return_value = mock.sentinel.response

View File

@ -17,7 +17,7 @@
import json
import pkg_resources
from hnv.common import utils
from hnvclient.common import utils
class FakeResponse(object):
@ -25,7 +25,7 @@ class FakeResponse(object):
"""HNV API fake responses."""
def __init__(self):
self._resources = "hnv.tests.fake.response"
self._resources = "hnvclient.tests.fake.response"
self._cache = {}
def _load_resource(self, resource):

View File

@ -21,11 +21,11 @@ try:
except ImportError:
import mock
from hnv import client
from hnv.common import exception
from hnv import CONFIG
from hnv.tests.fake import fake_response
from hnv.tests import utils as test_utils
from hnvclient import client
from hnvclient.common import exception
from hnvclient import CONFIG
from hnvclient.tests.fake import fake_response
from hnvclient.tests import utils as test_utils
class TestBaseHNVModel(unittest.TestCase):
@ -33,8 +33,8 @@ class TestBaseHNVModel(unittest.TestCase):
def setUp(self):
client._BaseHNVModel._endpoint = "{parent_id}/{resource_id}"
@mock.patch("hnv.client._BaseHNVModel.process_raw_data")
@mock.patch("hnv.client._BaseHNVModel._set_fields")
@mock.patch("hnvclient.client._BaseHNVModel.process_raw_data")
@mock.patch("hnvclient.client._BaseHNVModel._set_fields")
def test_reset_model(self, mock_set_fields, mock_process):
resource = client._BaseHNVModel()
@ -46,8 +46,8 @@ class TestBaseHNVModel(unittest.TestCase):
mock_process.assert_called_once_with(mock.sentinel.response)
mock_set_fields.assert_called_once_with(mock.sentinel.fields)
@mock.patch("hnv.client._BaseHNVModel.from_raw_data")
@mock.patch("hnv.client._BaseHNVModel._get_client")
@mock.patch("hnvclient.client._BaseHNVModel.from_raw_data")
@mock.patch("hnvclient.client._BaseHNVModel._get_client")
def test_get(self, mock_get_client, mock_from_raw_data):
mock_from_raw_data.return_value = mock.sentinel.resource
http_client = mock_get_client.return_value = mock.Mock()
@ -59,8 +59,8 @@ class TestBaseHNVModel(unittest.TestCase):
get_resource.assert_called_once_with("/hnv-client-test")
self.assertIs(resource, mock.sentinel.resource)
@mock.patch("hnv.client._BaseHNVModel.from_raw_data")
@mock.patch("hnv.client._BaseHNVModel._get_client")
@mock.patch("hnvclient.client._BaseHNVModel.from_raw_data")
@mock.patch("hnvclient.client._BaseHNVModel._get_client")
def test_get_all(self, mock_get_client, mock_from_raw_data):
mock_from_raw_data.side_effect = [{} for index in range(10)]
@ -74,8 +74,8 @@ class TestBaseHNVModel(unittest.TestCase):
self.assertEqual(resources, [{} for _ in range(10)])
@mock.patch("time.sleep")
@mock.patch("hnv.client._BaseHNVModel._get")
@mock.patch("hnv.client._BaseHNVModel._get_client")
@mock.patch("hnvclient.client._BaseHNVModel._get")
@mock.patch("hnvclient.client._BaseHNVModel._get_client")
def _test_remove(self, mock_get_client, mock_get, mock_sleep,
loop_count, timeout):
resource = mock.Mock()
@ -120,11 +120,11 @@ class TestBaseHNVModel(unittest.TestCase):
return {"properties": {"provisioningState": provisioning_state}}
@mock.patch("time.sleep")
@mock.patch("hnv.client._BaseHNVModel._reset_model")
@mock.patch("hnv.client._BaseHNVModel.is_ready")
@mock.patch("hnv.client._BaseHNVModel.refresh")
@mock.patch("hnv.client._BaseHNVModel.dump")
@mock.patch("hnv.client._BaseHNVModel._get_client")
@mock.patch("hnvclient.client._BaseHNVModel._reset_model")
@mock.patch("hnvclient.client._BaseHNVModel.is_ready")
@mock.patch("hnvclient.client._BaseHNVModel.refresh")
@mock.patch("hnvclient.client._BaseHNVModel.dump")
@mock.patch("hnvclient.client._BaseHNVModel._get_client")
def _test_commit(self, mock_get_client, mock_dump, mock_refresh,
mock_is_ready, mock_reset_model, mock_sleep,
loop_count, timeout, failed, invalid_response):
@ -189,8 +189,8 @@ class TestBaseHNVModel(unittest.TestCase):
self._test_commit(loop_count=1, timeout=False,
failed=False, invalid_response=True)
@mock.patch("hnv.client._BaseHNVModel._reset_model")
@mock.patch("hnv.client._BaseHNVModel._get_client")
@mock.patch("hnvclient.client._BaseHNVModel._reset_model")
@mock.patch("hnvclient.client._BaseHNVModel._get_client")
def test_refresh(self, mock_get_client, mock_reset_model):
http_client = mock_get_client.return_value = mock.Mock()
get_resource = http_client.get_resource = mock.Mock()
@ -211,7 +211,7 @@ class TestClient(unittest.TestCase):
self.maxDiff = None
def _test_get_resource(self, model, raw_data):
with test_utils.LogSnatcher("hnv.common.model") as logging:
with test_utils.LogSnatcher("hnvclient.common.model") as logging:
model.from_raw_data(raw_data)
self.assertEqual(logging.output, [])

View File

@ -21,7 +21,7 @@ import logging as base_logging
from oslo_log import log as oslo_logging
from hnv import CONFIG as hnv_config
from hnvclient import CONFIG
class SnatchHandler(base_logging.Handler):
@ -84,7 +84,7 @@ class ConfigPatcher(object):
self._key = key
self._value = value
self._original_value = None
self._config = hnv_config
self._config = CONFIG
def __call__(self, func, *args, **kwargs):
def _wrapped_f(*args, **kwargs):

View File

@ -1,5 +1,5 @@
==================
hnv Release Notes
hnvclient Release Notes
==================
.. toctree::

View File

@ -22,7 +22,7 @@ classifier =
[files]
packages =
hnv
hnvclient
[global]
setup-hooks =
@ -39,18 +39,18 @@ all_files = 1
upload-dir = doc/build/html
[compile_catalog]
directory = hnv/locale
domain = hnv
directory = hnvclient/locale
domain = hnvclient
[update_catalog]
domain = hnv
output_dir = hnv/locale
input_file = hnv/locale/hnv.pot
domain = hnvclient
output_dir = hnvclient/locale
input_file = hnvclient/locale/hnvclient.pot
[extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg
output_file = hnv/locale/hnv.pot
output_file = hnvclient/locale/hnvclient.pot
[build_releasenotes]
all_files = 1