Rename from reddwarf to trove.
Implements Blueprint reddwarf-trove-rename Change-Id: Ib2d694c7466887ca297bea4250eca17cdc06b7bf
This commit is contained in:
parent
bc90b3e088
commit
9916c8f273
@ -2,7 +2,7 @@
|
||||
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
|
||||
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
|
||||
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
|
||||
${PYTHON:-python} -m subunit.run discover . $LISTOPT $IDOPTION
|
||||
${PYTHON:-python} -m subunit.run discover -t ./ ./troveclient/tests $LISTOPT $IDOPTION
|
||||
|
||||
test_id_option=--load-list $IDFILE
|
||||
test_list_option=--list
|
||||
|
10
README.rst
10
README.rst
@ -1,9 +1,9 @@
|
||||
Python bindings to the Reddwarf API
|
||||
Python bindings to the Trove API
|
||||
==================================================
|
||||
|
||||
This is a client for the Reddwarf API. There's a Python API (the
|
||||
``reddwarfclient`` module), and a command-line script (``reddwarf``). Each
|
||||
implements 100% (or less ;) ) of the Reddwarf API.
|
||||
This is a client for the Trove API. There's a Python API (the
|
||||
``troveclient`` module), and a command-line script (``trove``). Each
|
||||
implements 100% (or less ;) ) of the Trove API.
|
||||
|
||||
Command-line API
|
||||
----------------
|
||||
@ -13,7 +13,7 @@ tenant, and appropriate auth url.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ reddwarf-cli --username=jsmith --apikey=abcdefg --tenant=12345 --auth_url=http://reddwarf_auth:35357/v2.0/tokens auth login
|
||||
$ trove-cli --username=jsmith --apikey=abcdefg --tenant=12345 --auth_url=http://trove_auth:35357/v2.0/tokens auth login
|
||||
|
||||
At this point you will be authenticated and given a token, which is stored
|
||||
at ~/.apitoken. From there you can make other calls to the CLI.
|
||||
|
@ -1,31 +0,0 @@
|
||||
# Copyright (c) 2011 OpenStack, LLC.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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.
|
||||
|
||||
|
||||
from reddwarfclient.accounts import Accounts
|
||||
from reddwarfclient.databases import Databases
|
||||
from reddwarfclient.flavors import Flavors
|
||||
from reddwarfclient.instances import Instances
|
||||
from reddwarfclient.hosts import Hosts
|
||||
from reddwarfclient.management import Management
|
||||
from reddwarfclient.management import RootHistory
|
||||
from reddwarfclient.root import Root
|
||||
from reddwarfclient.storage import StorageInfo
|
||||
from reddwarfclient.users import Users
|
||||
from reddwarfclient.versions import Versions
|
||||
from reddwarfclient.diagnostics import DiagnosticsInterrogator
|
||||
from reddwarfclient.diagnostics import HwInfoInterrogator
|
||||
from reddwarfclient.client import Dbaas
|
||||
from reddwarfclient.client import ReddwarfHTTPClient
|
18
run_local.sh
18
run_local.sh
@ -9,9 +9,9 @@ me=${0##*/}
|
||||
|
||||
function print_usage() {
|
||||
cat >&2 <<EOS
|
||||
Run tests against a local instance of reddwarf
|
||||
Run tests against a local instance of trove
|
||||
|
||||
Usage: $me reddwarf_path [logfile]
|
||||
Usage: $me trove_path [logfile]
|
||||
EOS
|
||||
}
|
||||
|
||||
@ -28,25 +28,25 @@ if [ $# -lt 1 ]; then
|
||||
exit 5
|
||||
fi
|
||||
|
||||
reddwarf_path=$1
|
||||
reddwarf_pid_file="`pwd`.pid"
|
||||
trove_path=$1
|
||||
trove_pid_file="`pwd`.pid"
|
||||
|
||||
function start_server() {
|
||||
server_log=`pwd`/rdserver.txt
|
||||
set +e
|
||||
rm $server_log
|
||||
set -e
|
||||
pushd $reddwarf_path
|
||||
bin/start_server.sh --pid-file=$reddwarf_pid_file \
|
||||
pushd $trove_path
|
||||
bin/start_server.sh --pid-file=$trove_pid_file \
|
||||
--override-logfile=$server_log
|
||||
popd
|
||||
}
|
||||
|
||||
function stop_server() {
|
||||
if [ -f $reddwarf_pid_file ];
|
||||
if [ -f $trove_pid_file ];
|
||||
then
|
||||
pushd $reddwarf_path
|
||||
bin/stop_server.sh $reddwarf_pid_file
|
||||
pushd $trove_path
|
||||
bin/stop_server.sh $trove_pid_file
|
||||
popd
|
||||
else
|
||||
echo "The pid file did not exist, so not stopping server."
|
||||
|
@ -19,12 +19,12 @@ classifier =
|
||||
|
||||
[entry_points]
|
||||
console_scripts =
|
||||
reddwarf-cli = reddwarfclient.cli:main
|
||||
reddwarf-mgmt-cli = reddwarfclient.mcli:main
|
||||
trove-cli = troveclient.cli:main
|
||||
trove-mgmt-cli = troveclient.mcli:main
|
||||
|
||||
[files]
|
||||
packages =
|
||||
reddwarfclient
|
||||
troveclient
|
||||
|
||||
[global]
|
||||
setup-hooks =
|
||||
|
@ -8,7 +8,5 @@ discover
|
||||
sphinx>=1.1.2
|
||||
testrepository>=0.0.13
|
||||
testtools>=0.9.29
|
||||
# This used to be but openstack/requirements is set to [below].
|
||||
# If this breaks we 1) fix tests to use [below] or
|
||||
# 2) petition to use mock>=1.0.1
|
||||
mock>=0.8.0
|
||||
|
||||
|
31
troveclient/__init__.py
Normal file
31
troveclient/__init__.py
Normal file
@ -0,0 +1,31 @@
|
||||
# Copyright (c) 2011 OpenStack, LLC.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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.
|
||||
|
||||
|
||||
from troveclient.accounts import Accounts
|
||||
from troveclient.databases import Databases
|
||||
from troveclient.flavors import Flavors
|
||||
from troveclient.instances import Instances
|
||||
from troveclient.hosts import Hosts
|
||||
from troveclient.management import Management
|
||||
from troveclient.management import RootHistory
|
||||
from troveclient.root import Root
|
||||
from troveclient.storage import StorageInfo
|
||||
from troveclient.users import Users
|
||||
from troveclient.versions import Versions
|
||||
from troveclient.diagnostics import DiagnosticsInterrogator
|
||||
from troveclient.diagnostics import HwInfoInterrogator
|
||||
from troveclient.client import Dbaas
|
||||
from troveclient.client import TroveHTTPClient
|
@ -13,8 +13,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from reddwarfclient import base
|
||||
from reddwarfclient.common import check_for_exceptions
|
||||
from troveclient import base
|
||||
from troveclient.common import check_for_exceptions
|
||||
|
||||
|
||||
class Account(base.Resource):
|
@ -12,7 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from reddwarfclient import exceptions
|
||||
from troveclient import exceptions
|
||||
|
||||
|
||||
def get_authenticator_cls(cls_or_name):
|
||||
@ -228,7 +228,7 @@ class ServiceCatalog(object):
|
||||
def _url_for(self, attr=None, filter_value=None,
|
||||
endpoint_type='publicURL'):
|
||||
"""
|
||||
Fetch the public URL from the Reddwarf service for a particular
|
||||
Fetch the public URL from the Trove service for a particular
|
||||
endpoint attribute. If none given, return the first.
|
||||
"""
|
||||
matching_endpoints = []
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from reddwarfclient import base
|
||||
from troveclient import base
|
||||
import exceptions
|
||||
|
||||
|
@ -22,8 +22,8 @@ Base utilities to build API operation managers and objects on top of.
|
||||
import contextlib
|
||||
import hashlib
|
||||
import os
|
||||
from reddwarfclient import exceptions
|
||||
from reddwarfclient import utils
|
||||
from troveclient import exceptions
|
||||
from troveclient import utils
|
||||
|
||||
|
||||
# Python 2.4 compat
|
||||
@ -93,7 +93,7 @@ class Manager(utils.HookableMixin):
|
||||
often enough to keep the cache reasonably up-to-date.
|
||||
"""
|
||||
base_dir = utils.env('REDDWARFCLIENT_ID_CACHE_DIR',
|
||||
default="~/.reddwarfclient")
|
||||
default="~/.troveclient")
|
||||
|
||||
# NOTE(sirp): Keep separate UUID caches for each username + endpoint
|
||||
# pair
|
@ -15,7 +15,7 @@
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
Reddwarf Command line tool
|
||||
Trove Command line tool
|
||||
"""
|
||||
|
||||
#TODO(tim.simpson): optparse is deprecated. Replace with argparse.
|
||||
@ -24,17 +24,17 @@ import os
|
||||
import sys
|
||||
|
||||
|
||||
# If ../reddwarf/__init__.py exists, add ../ to Python search path, so that
|
||||
# If ../trove/__init__.py exists, add ../ to Python search path, so that
|
||||
# it will override what happens to be installed in /usr/(local/)lib/python...
|
||||
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
||||
os.pardir,
|
||||
os.pardir))
|
||||
if os.path.exists(os.path.join(possible_topdir, 'reddwarfclient',
|
||||
if os.path.exists(os.path.join(possible_topdir, 'troveclient',
|
||||
'__init__.py')):
|
||||
sys.path.insert(0, possible_topdir)
|
||||
|
||||
|
||||
from reddwarfclient import common
|
||||
from troveclient import common
|
||||
|
||||
|
||||
class InstanceCommands(common.AuthedCommandsBase):
|
@ -30,8 +30,8 @@ if not hasattr(urlparse, 'parse_qsl'):
|
||||
import cgi
|
||||
urlparse.parse_qsl = cgi.parse_qsl
|
||||
|
||||
from reddwarfclient import auth
|
||||
from reddwarfclient import exceptions
|
||||
from troveclient import auth
|
||||
from troveclient import exceptions
|
||||
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
@ -52,9 +52,9 @@ if 'REDDWARFCLIENT_DEBUG' in os.environ and os.environ['REDDWARFCLIENT_DEBUG']:
|
||||
log_to_streamhandler()
|
||||
|
||||
|
||||
class ReddwarfHTTPClient(httplib2.Http):
|
||||
class TroveHTTPClient(httplib2.Http):
|
||||
|
||||
USER_AGENT = 'python-reddwarfclient'
|
||||
USER_AGENT = 'python-troveclient'
|
||||
|
||||
def __init__(self, user, password, tenant, auth_url, service_name,
|
||||
service_url=None,
|
||||
@ -64,7 +64,7 @@ class ReddwarfHTTPClient(httplib2.Http):
|
||||
endpoint_type='publicURL', service_type=None,
|
||||
timings=False):
|
||||
|
||||
super(ReddwarfHTTPClient, self).__init__(timeout=timeout)
|
||||
super(TroveHTTPClient, self).__init__(timeout=timeout)
|
||||
|
||||
self.username = user
|
||||
self.password = password
|
||||
@ -130,7 +130,7 @@ class ReddwarfHTTPClient(httplib2.Http):
|
||||
_logger.debug("RESP:%s %s\n", resp, body)
|
||||
|
||||
def pretty_log(self, args, kwargs, resp, body):
|
||||
from reddwarfclient import common
|
||||
from troveclient import common
|
||||
if not _logger.isEnabledFor(logging.DEBUG):
|
||||
return
|
||||
|
||||
@ -170,7 +170,7 @@ class ReddwarfHTTPClient(httplib2.Http):
|
||||
kwargs['headers']['User-Agent'] = self.USER_AGENT
|
||||
self.morph_request(kwargs)
|
||||
|
||||
resp, body = super(ReddwarfHTTPClient, self).request(*args, **kwargs)
|
||||
resp, body = super(TroveHTTPClient, self).request(*args, **kwargs)
|
||||
|
||||
# Save this in case anyone wants it.
|
||||
self.last_response = (resp, body)
|
||||
@ -297,26 +297,26 @@ class Dbaas(object):
|
||||
"""
|
||||
|
||||
def __init__(self, username, api_key, tenant=None, auth_url=None,
|
||||
service_type='database', service_name='reddwarf',
|
||||
service_type='database', service_name='trove',
|
||||
service_url=None, insecure=False, auth_strategy='keystone',
|
||||
region_name=None, client_cls=ReddwarfHTTPClient):
|
||||
from reddwarfclient.versions import Versions
|
||||
from reddwarfclient.databases import Databases
|
||||
from reddwarfclient.flavors import Flavors
|
||||
from reddwarfclient.instances import Instances
|
||||
from reddwarfclient.limits import Limits
|
||||
from reddwarfclient.users import Users
|
||||
from reddwarfclient.root import Root
|
||||
from reddwarfclient.hosts import Hosts
|
||||
from reddwarfclient.quota import Quotas
|
||||
from reddwarfclient.backups import Backups
|
||||
from reddwarfclient.security_groups import SecurityGroups
|
||||
from reddwarfclient.security_groups import SecurityGroupRules
|
||||
from reddwarfclient.storage import StorageInfo
|
||||
from reddwarfclient.management import Management
|
||||
from reddwarfclient.accounts import Accounts
|
||||
from reddwarfclient.diagnostics import DiagnosticsInterrogator
|
||||
from reddwarfclient.diagnostics import HwInfoInterrogator
|
||||
region_name=None, client_cls=TroveHTTPClient):
|
||||
from troveclient.versions import Versions
|
||||
from troveclient.databases import Databases
|
||||
from troveclient.flavors import Flavors
|
||||
from troveclient.instances import Instances
|
||||
from troveclient.limits import Limits
|
||||
from troveclient.users import Users
|
||||
from troveclient.root import Root
|
||||
from troveclient.hosts import Hosts
|
||||
from troveclient.quota import Quotas
|
||||
from troveclient.backups import Backups
|
||||
from troveclient.security_groups import SecurityGroups
|
||||
from troveclient.security_groups import SecurityGroupRules
|
||||
from troveclient.storage import StorageInfo
|
||||
from troveclient.management import Management
|
||||
from troveclient.accounts import Accounts
|
||||
from troveclient.diagnostics import DiagnosticsInterrogator
|
||||
from troveclient.diagnostics import HwInfoInterrogator
|
||||
|
||||
self.client = client_cls(username, api_key, tenant, auth_url,
|
||||
service_type=service_type,
|
@ -19,9 +19,9 @@ import os
|
||||
import pickle
|
||||
import sys
|
||||
|
||||
from reddwarfclient import client
|
||||
from reddwarfclient.xml import ReddwarfXmlClient
|
||||
from reddwarfclient import exceptions
|
||||
from troveclient import client
|
||||
from troveclient.xml import TroveXmlClient
|
||||
from troveclient import exceptions
|
||||
|
||||
from urllib import quote
|
||||
|
||||
@ -92,7 +92,7 @@ class CliOptions(object):
|
||||
'auth_url': None,
|
||||
'auth_type': 'keystone',
|
||||
'service_type': 'database',
|
||||
'service_name': 'reddwarf',
|
||||
'service_name': 'trove',
|
||||
'region': 'RegionOne',
|
||||
'service_url': None,
|
||||
'insecure': False,
|
||||
@ -204,9 +204,9 @@ class CommandsBase(object):
|
||||
"""Creates the all important client object."""
|
||||
try:
|
||||
if self.xml:
|
||||
client_cls = ReddwarfXmlClient
|
||||
client_cls = TroveXmlClient
|
||||
else:
|
||||
client_cls = client.ReddwarfHTTPClient
|
||||
client_cls = client.TroveHTTPClient
|
||||
if self.verbose:
|
||||
client.log_to_streamhandler(sys.stdout)
|
||||
client.RDC_PP = True
|
@ -1,7 +1,7 @@
|
||||
from reddwarfclient import base
|
||||
from reddwarfclient.common import check_for_exceptions
|
||||
from reddwarfclient.common import limit_url
|
||||
from reddwarfclient.common import Paginated
|
||||
from troveclient import base
|
||||
from troveclient.common import check_for_exceptions
|
||||
from troveclient.common import limit_url
|
||||
from troveclient.common import Paginated
|
||||
import exceptions
|
||||
import urlparse
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from reddwarfclient import base
|
||||
from troveclient import base
|
||||
import exceptions
|
||||
|
||||
|
@ -14,11 +14,11 @@
|
||||
# under the License.
|
||||
|
||||
|
||||
from reddwarfclient import base
|
||||
from troveclient import base
|
||||
|
||||
import exceptions
|
||||
|
||||
from reddwarfclient.common import check_for_exceptions
|
||||
from troveclient.common import check_for_exceptions
|
||||
|
||||
|
||||
class Flavor(base.Resource):
|
@ -13,9 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from reddwarfclient import base
|
||||
from troveclient import base
|
||||
|
||||
from reddwarfclient.common import check_for_exceptions
|
||||
from troveclient.common import check_for_exceptions
|
||||
|
||||
|
||||
class Host(base.Resource):
|
@ -13,14 +13,14 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from reddwarfclient import base
|
||||
from troveclient import base
|
||||
|
||||
import exceptions
|
||||
import urlparse
|
||||
|
||||
from reddwarfclient.common import check_for_exceptions
|
||||
from reddwarfclient.common import limit_url
|
||||
from reddwarfclient.common import Paginated
|
||||
from troveclient.common import check_for_exceptions
|
||||
from troveclient.common import limit_url
|
||||
from troveclient.common import Paginated
|
||||
|
||||
|
||||
REBOOT_SOFT, REBOOT_HARD = 'SOFT', 'HARD'
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from reddwarfclient import base
|
||||
from troveclient import base
|
||||
import exceptions
|
||||
|
||||
|
@ -13,13 +13,13 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from reddwarfclient import base
|
||||
from troveclient import base
|
||||
import urlparse
|
||||
|
||||
from reddwarfclient.common import check_for_exceptions
|
||||
from reddwarfclient.common import limit_url
|
||||
from reddwarfclient.common import Paginated
|
||||
from reddwarfclient.instances import Instance
|
||||
from troveclient.common import check_for_exceptions
|
||||
from troveclient.common import limit_url
|
||||
from troveclient.common import Paginated
|
||||
from troveclient.instances import Instance
|
||||
|
||||
|
||||
class RootHistory(base.Resource):
|
@ -15,7 +15,7 @@
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
Reddwarf Management Command line tool
|
||||
Trove Management Command line tool
|
||||
"""
|
||||
|
||||
import json
|
||||
@ -24,17 +24,17 @@ import os
|
||||
import sys
|
||||
|
||||
|
||||
# If ../reddwarf/__init__.py exists, add ../ to Python search path, so that
|
||||
# If ../trove/__init__.py exists, add ../ to Python search path, so that
|
||||
# it will override what happens to be installed in /usr/(local/)lib/python...
|
||||
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
||||
os.pardir,
|
||||
os.pardir))
|
||||
if os.path.exists(os.path.join(possible_topdir, 'reddwarfclient',
|
||||
if os.path.exists(os.path.join(possible_topdir, 'troveclient',
|
||||
'__init__.py')):
|
||||
sys.path.insert(0, possible_topdir)
|
||||
|
||||
|
||||
from reddwarfclient import common
|
||||
from troveclient import common
|
||||
|
||||
|
||||
oparser = None
|
@ -13,8 +13,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from reddwarfclient import base
|
||||
from reddwarfclient.common import check_for_exceptions
|
||||
from troveclient import base
|
||||
from troveclient.common import check_for_exceptions
|
||||
|
||||
|
||||
class Quotas(base.ManagerWithFind):
|
@ -13,10 +13,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from reddwarfclient import base
|
||||
from troveclient import base
|
||||
|
||||
from reddwarfclient import users
|
||||
from reddwarfclient.common import check_for_exceptions
|
||||
from troveclient import users
|
||||
from troveclient.common import check_for_exceptions
|
||||
import exceptions
|
||||
|
||||
|
@ -14,13 +14,13 @@
|
||||
# under the License.
|
||||
#
|
||||
|
||||
from reddwarfclient import base
|
||||
from troveclient import base
|
||||
|
||||
import exceptions
|
||||
import urlparse
|
||||
|
||||
from reddwarfclient.common import limit_url
|
||||
from reddwarfclient.common import Paginated
|
||||
from troveclient.common import limit_url
|
||||
from troveclient.common import Paginated
|
||||
|
||||
|
||||
class SecurityGroup(base.Resource):
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from reddwarfclient import base
|
||||
from troveclient import base
|
||||
|
||||
|
||||
class Device(base.Resource):
|
0
troveclient/tests/__init__.py
Normal file
0
troveclient/tests/__init__.py
Normal file
@ -1,8 +1,8 @@
|
||||
from testtools import TestCase
|
||||
from mock import Mock
|
||||
|
||||
from reddwarfclient import accounts
|
||||
from reddwarfclient import base
|
||||
from troveclient import accounts
|
||||
from troveclient import base
|
||||
|
||||
"""
|
||||
Unit tests for accounts.py
|
@ -1,10 +1,10 @@
|
||||
import contextlib
|
||||
|
||||
from testtools import TestCase
|
||||
from reddwarfclient import auth
|
||||
from troveclient import auth
|
||||
from mock import Mock
|
||||
|
||||
from reddwarfclient import exceptions
|
||||
from troveclient import exceptions
|
||||
|
||||
"""
|
||||
Unit tests for the classes and functions in auth.py.
|
||||
@ -129,8 +129,8 @@ class KeyStoneV2AuthenticatorTest(TestCase):
|
||||
self.assertEqual(url, r)
|
||||
|
||||
def test__v2_auth(self):
|
||||
username = "reddwarf_user"
|
||||
password = "reddwarf_password"
|
||||
username = "trove_user"
|
||||
password = "trove_password"
|
||||
tenant = "tenant"
|
||||
cls_type = auth.KeyStoneV2Authenticator
|
||||
authObj = auth.KeyStoneV2Authenticator(url=None, type=cls_type,
|
||||
@ -159,8 +159,8 @@ class Auth1_1Test(TestCase):
|
||||
check_url_none(self, auth.Auth1_1)
|
||||
|
||||
# url is not none
|
||||
username = "reddwarf_user"
|
||||
password = "reddwarf_password"
|
||||
username = "trove_user"
|
||||
password = "trove_password"
|
||||
url = "test_url"
|
||||
authObj = auth.Auth1_1(url=url,
|
||||
type=auth.Auth1_1,
|
||||
@ -204,8 +204,8 @@ class RaxAuthenticatorTest(TestCase):
|
||||
self.assertEqual(url, r)
|
||||
|
||||
def test__rax_auth(self):
|
||||
username = "reddwarf_user"
|
||||
password = "reddwarf_password"
|
||||
username = "trove_user"
|
||||
password = "trove_password"
|
||||
tenant = "tenant"
|
||||
authObj = auth.RaxAuthenticator(url=None,
|
||||
type=auth.RaxAuthenticator,
|
||||
@ -359,12 +359,12 @@ class ServiceCatalogTest(TestCase):
|
||||
self.assertEqual(self.test_url, r_url)
|
||||
|
||||
def case_ambiguous_endpoint(self, scObj):
|
||||
scObj.service_type = "reddwarf"
|
||||
scObj.service_type = "trove"
|
||||
scObj.service_name = "test_service_name"
|
||||
|
||||
def side_effect_func_service(key):
|
||||
if key == "type":
|
||||
return "reddwarf"
|
||||
return "trove"
|
||||
elif key == "name":
|
||||
return "test_service_name"
|
||||
return None
|
@ -4,9 +4,9 @@ import os
|
||||
from testtools import TestCase
|
||||
from mock import Mock
|
||||
|
||||
from reddwarfclient import base
|
||||
from reddwarfclient import exceptions
|
||||
from reddwarfclient import utils
|
||||
from troveclient import base
|
||||
from troveclient import exceptions
|
||||
from troveclient import utils
|
||||
|
||||
"""
|
||||
Unit tests for base.py
|
@ -7,9 +7,9 @@ import time
|
||||
from testtools import TestCase
|
||||
from mock import Mock
|
||||
|
||||
from reddwarfclient import client
|
||||
from reddwarfclient import exceptions
|
||||
from reddwarfclient import utils
|
||||
from troveclient import client
|
||||
from troveclient import exceptions
|
||||
from troveclient import utils
|
||||
|
||||
"""
|
||||
Unit tests for client.py
|
||||
@ -23,13 +23,13 @@ class ClientTest(TestCase):
|
||||
self.assertTrue(client._logger.level == logging.DEBUG)
|
||||
|
||||
|
||||
class ReddwarfHTTPClientTest(TestCase):
|
||||
class TroveHTTPClientTest(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ReddwarfHTTPClientTest, self).setUp()
|
||||
self.orig__init = client.ReddwarfHTTPClient.__init__
|
||||
client.ReddwarfHTTPClient.__init__ = Mock(return_value=None)
|
||||
self.hc = client.ReddwarfHTTPClient()
|
||||
super(TroveHTTPClientTest, self).setUp()
|
||||
self.orig__init = client.TroveHTTPClient.__init__
|
||||
client.TroveHTTPClient.__init__ = Mock(return_value=None)
|
||||
self.hc = client.TroveHTTPClient()
|
||||
self.hc.auth_token = "test-auth-token"
|
||||
self.hc.service_url = "test-service-url/"
|
||||
self.hc.tenant = "test-tenant"
|
||||
@ -43,8 +43,8 @@ class ReddwarfHTTPClientTest(TestCase):
|
||||
self.orig_htttp_request = httplib2.Http.request
|
||||
|
||||
def tearDown(self):
|
||||
super(ReddwarfHTTPClientTest, self).tearDown()
|
||||
client.ReddwarfHTTPClient.__init__ = self.orig__init
|
||||
super(TroveHTTPClientTest, self).tearDown()
|
||||
client.TroveHTTPClient.__init__ = self.orig__init
|
||||
client._logger = self.orig_client__logger
|
||||
time.time = self.orig_time
|
||||
httplib2.Http.request = self.orig_htttp_request
|
||||
@ -53,7 +53,7 @@ class ReddwarfHTTPClientTest(TestCase):
|
||||
self.__debug_lines.append(s)
|
||||
|
||||
def test___init__(self):
|
||||
client.ReddwarfHTTPClient.__init__ = self.orig__init
|
||||
client.TroveHTTPClient.__init__ = self.orig__init
|
||||
|
||||
user = "test-user"
|
||||
password = "test-password"
|
||||
@ -62,15 +62,15 @@ class ReddwarfHTTPClientTest(TestCase):
|
||||
service_name = None
|
||||
|
||||
# when there is no auth_strategy provided
|
||||
self.assertRaises(ValueError, client.ReddwarfHTTPClient, user,
|
||||
self.assertRaises(ValueError, client.TroveHTTPClient, user,
|
||||
password, tenant, auth_url, service_name)
|
||||
|
||||
hc = client.ReddwarfHTTPClient(user, password, tenant, auth_url,
|
||||
hc = client.TroveHTTPClient(user, password, tenant, auth_url,
|
||||
service_name, auth_strategy="fake")
|
||||
self.assertEqual("http://test-auth-url", hc.auth_url)
|
||||
|
||||
# auth_url is none
|
||||
hc = client.ReddwarfHTTPClient(user, password, tenant, None,
|
||||
hc = client.TroveHTTPClient(user, password, tenant, None,
|
||||
service_name, auth_strategy="fake")
|
||||
self.assertEqual(None, hc.auth_url)
|
||||
|
||||
@ -157,7 +157,7 @@ class ReddwarfHTTPClientTest(TestCase):
|
||||
status_list = [400, 401, 403, 404, 408, 409, 413, 500, 501]
|
||||
for status in status_list:
|
||||
resp.status = status
|
||||
self.assertRaises(ValueError, self.hc.request)
|
||||
self.assertRaises(Exception, self.hc.request)
|
||||
|
||||
exception = exceptions.ResponseFormatError
|
||||
self.hc.morph_response_body = Mock(side_effect=exception)
|
||||
@ -171,7 +171,7 @@ class ReddwarfHTTPClientTest(TestCase):
|
||||
status_list = [400, 401, 403, 404, 408, 409, 413, 500, 501]
|
||||
for status in status_list:
|
||||
resp.status = status
|
||||
self.assertRaises(ValueError,
|
||||
self.assertRaises(Exception,
|
||||
self.hc.raise_error_from_status, resp, Mock())
|
||||
|
||||
def test_morph_request(self):
|
||||
@ -293,16 +293,16 @@ class DbaasTest(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(DbaasTest, self).setUp()
|
||||
self.orig__init = client.ReddwarfHTTPClient.__init__
|
||||
client.ReddwarfHTTPClient.__init__ = Mock(return_value=None)
|
||||
self.orig__init = client.TroveHTTPClient.__init__
|
||||
client.TroveHTTPClient.__init__ = Mock(return_value=None)
|
||||
self.dbaas = client.Dbaas("user", "api-key")
|
||||
|
||||
def tearDown(self):
|
||||
super(DbaasTest, self).tearDown()
|
||||
client.ReddwarfHTTPClient.__init__ = self.orig__init
|
||||
client.TroveHTTPClient.__init__ = self.orig__init
|
||||
|
||||
def test___init__(self):
|
||||
client.ReddwarfHTTPClient.__init__ = Mock(return_value=None)
|
||||
client.TroveHTTPClient.__init__ = Mock(return_value=None)
|
||||
self.assertNotEqual(None, self.dbaas.mgmt)
|
||||
|
||||
def test_set_management_url(self):
|
@ -6,8 +6,8 @@ import collections
|
||||
from testtools import TestCase
|
||||
from mock import Mock
|
||||
|
||||
from reddwarfclient import common
|
||||
from reddwarfclient import client
|
||||
from troveclient import common
|
||||
from troveclient import client
|
||||
|
||||
"""
|
||||
unit tests for common.py
|
||||
@ -41,7 +41,7 @@ class CommonTest(TestCase):
|
||||
for s in status:
|
||||
resp = Mock()
|
||||
resp.status = s
|
||||
self.assertRaises(ValueError,
|
||||
self.assertRaises(Exception,
|
||||
common.check_for_exceptions, resp, "body")
|
||||
|
||||
# a no-exception case
|
||||
@ -82,7 +82,7 @@ class CliOptionsTest(TestCase):
|
||||
self.assertEqual(None, co.auth_url)
|
||||
self.assertEqual('keystone', co.auth_type)
|
||||
self.assertEqual('database', co.service_type)
|
||||
self.assertEqual('reddwarf', co.service_name)
|
||||
self.assertEqual('trove', co.service_name)
|
||||
self.assertEqual('RegionOne', co.region)
|
||||
self.assertEqual(None, co.service_url)
|
||||
self.assertFalse(co.insecure)
|
@ -1,8 +1,8 @@
|
||||
from testtools import TestCase
|
||||
from mock import Mock
|
||||
|
||||
from reddwarfclient import instances
|
||||
from reddwarfclient import base
|
||||
from troveclient import instances
|
||||
from troveclient import base
|
||||
|
||||
"""
|
||||
Unit tests for instances.py
|
||||
@ -118,7 +118,7 @@ class InstancesTest(TestCase):
|
||||
self.instances.api.client.delete = Mock(return_value=(resp, body))
|
||||
self.instances.delete('instance1')
|
||||
resp.status = 500
|
||||
self.assertRaises(ValueError, self.instances.delete, 'instance1')
|
||||
self.assertRaises(Exception, self.instances.delete, 'instance1')
|
||||
|
||||
def test__action(self):
|
||||
body = Mock()
|
@ -1,6 +1,6 @@
|
||||
from testtools import TestCase
|
||||
from mock import Mock
|
||||
from reddwarfclient import limits
|
||||
from troveclient import limits
|
||||
|
||||
|
||||
class LimitsTest(TestCase):
|
@ -1,8 +1,8 @@
|
||||
from testtools import TestCase
|
||||
from mock import Mock
|
||||
|
||||
from reddwarfclient import management
|
||||
from reddwarfclient import base
|
||||
from troveclient import management
|
||||
from troveclient import base
|
||||
|
||||
"""
|
||||
Unit tests for management.py
|
||||
@ -96,7 +96,7 @@ class ManagementTest(TestCase):
|
||||
self.management._action(1, 'body')
|
||||
self.assertEqual(1, self.management.api.client.post.call_count)
|
||||
resp.status = 400
|
||||
self.assertRaises(ValueError, self.management._action, 1, 'body')
|
||||
self.assertRaises(Exception, self.management._action, 1, 'body')
|
||||
self.assertEqual(2, self.management.api.client.post.call_count)
|
||||
|
||||
def _mock_action(self):
|
@ -1,8 +1,8 @@
|
||||
from testtools import TestCase
|
||||
from mock import Mock
|
||||
|
||||
from reddwarfclient import security_groups
|
||||
from reddwarfclient import base
|
||||
from troveclient import security_groups
|
||||
from troveclient import base
|
||||
|
||||
"""
|
||||
Unit tests for security_groups.py
|
||||
@ -98,5 +98,5 @@ class SecGroupRuleTest(TestCase):
|
||||
Mock(return_value=(resp, body))
|
||||
self.security_group_rules.delete(self.id)
|
||||
resp.status = 500
|
||||
self.assertRaises(ValueError, self.security_group_rules.delete,
|
||||
self.assertRaises(Exception, self.security_group_rules.delete,
|
||||
self.id)
|
@ -1,8 +1,8 @@
|
||||
from testtools import TestCase
|
||||
from mock import Mock
|
||||
|
||||
from reddwarfclient import users
|
||||
from reddwarfclient import base
|
||||
from troveclient import users
|
||||
from troveclient import base
|
||||
|
||||
"""
|
||||
Unit tests for users.py
|
@ -1,7 +1,7 @@
|
||||
import os
|
||||
from testtools import TestCase
|
||||
from reddwarfclient import utils
|
||||
from reddwarfclient import versions
|
||||
from troveclient import utils
|
||||
from troveclient import versions
|
||||
|
||||
|
||||
class UtilsTest(TestCase):
|
@ -1,6 +1,6 @@
|
||||
from testtools import TestCase
|
||||
from lxml import etree
|
||||
from reddwarfclient import xml
|
||||
from troveclient import xml
|
||||
|
||||
|
||||
class XmlTest(TestCase):
|
||||
@ -205,10 +205,10 @@ class XmlTest(TestCase):
|
||||
test_list = xml.modify_response_types(test_list["a_list"], TYPE_MAP)
|
||||
self.assertEqual([{'Int': 5}, {'Str': 'A'}], test_list)
|
||||
|
||||
def test_reddwarfxmlclient(self):
|
||||
from reddwarfclient import exceptions
|
||||
def test_trovexmlclient(self):
|
||||
from troveclient import exceptions
|
||||
|
||||
client = xml.ReddwarfXmlClient("user", "password", "tenant",
|
||||
client = xml.TroveXmlClient("user", "password", "tenant",
|
||||
"auth_url", "service_name",
|
||||
auth_strategy="fake")
|
||||
request = {'headers': {}}
|
@ -13,12 +13,12 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from reddwarfclient import base
|
||||
from reddwarfclient import databases
|
||||
from reddwarfclient.common import check_for_exceptions
|
||||
from reddwarfclient.common import limit_url
|
||||
from reddwarfclient.common import Paginated
|
||||
from reddwarfclient.common import quote_user_host
|
||||
from troveclient import base
|
||||
from troveclient import databases
|
||||
from troveclient.common import check_for_exceptions
|
||||
from troveclient.common import limit_url
|
||||
from troveclient.common import Paginated
|
||||
from troveclient.common import quote_user_host
|
||||
import exceptions
|
||||
import urlparse
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from reddwarfclient import base
|
||||
from troveclient import base
|
||||
|
||||
|
||||
class Version(base.Resource):
|
@ -2,8 +2,8 @@ from lxml import etree
|
||||
import json
|
||||
from numbers import Number
|
||||
|
||||
from reddwarfclient import exceptions
|
||||
from reddwarfclient.client import ReddwarfHTTPClient
|
||||
from troveclient import exceptions
|
||||
from troveclient.client import TroveHTTPClient
|
||||
|
||||
XML_NS = {None: "http://docs.openstack.org/database/api/v1.0"}
|
||||
|
||||
@ -262,7 +262,7 @@ def modify_response_types(value, type_translator):
|
||||
for element in value]
|
||||
|
||||
|
||||
class ReddwarfXmlClient(ReddwarfHTTPClient):
|
||||
class TroveXmlClient(TroveHTTPClient):
|
||||
|
||||
@classmethod
|
||||
def morph_request(self, kwargs):
|
Loading…
Reference in New Issue
Block a user