Rename "endpoint" to "credential" (part 1)

Copied rally/common/objects/endpoint.py to credential.py
Marked objects.Endpoint as deprecated
Modified use of objects.Endpoint to objects.Credential
Variable and key names are not changed in this patch

Partial-Bug: #1447682
Change-Id: Ia62881473d1bf63f952528b66e7420eea6323f08
This commit is contained in:
Bo Chi 2015-11-15 04:21:26 -05:00
parent 6d548e633c
commit dba80b2742
4 changed files with 14 additions and 10 deletions

View File

@ -216,7 +216,7 @@ class UserGenerator(UserContextMixin, context.Context):
user = client.create_user(username, password,
"%s@email.me" % username,
tenant_id, user_dom)
user_endpoint = objects.Endpoint(
user_endpoint = objects.Credential(
client.auth_url, user.name, password,
self.context["tenants"][tenant_id]["name"],
consts.EndpointPermission.USER, client.region_name,

View File

@ -275,6 +275,9 @@ def check_no_direct_rally_objects_import(logical_line, filename):
if filename == "./rally/common/objects/__init__.py":
return
if filename == "./rally/common/objects/endpoint.py":
return
if (logical_line.startswith("from rally.common.objects")
or logical_line.startswith("import rally.common.objects.")):
yield (0, "N340: Import objects module:"

View File

@ -1468,7 +1468,7 @@ class FakeClients(object):
self._murano = None
self._monasca = None
self._ec2 = None
self._endpoint = endpoint_ or objects.Endpoint(
self._endpoint = endpoint_ or objects.Credential(
"http://fake.example.org:5000/v2.0/",
"fake_username",
"fake_password",
@ -1649,11 +1649,11 @@ class FakeUserContext(FakeContext):
admin = {
"id": "adminuuid",
"endpoint": objects.Endpoint("aurl", "aname", "apwd", "atenant")
"endpoint": objects.Credential("aurl", "aname", "apwd", "atenant")
}
user = {
"id": "uuid",
"endpoint": objects.Endpoint("url", "name", "pwd", "tenant"),
"endpoint": objects.Credential("url", "name", "pwd", "tenant"),
"tenant_id": "uuid"
}
tenants = {"uuid": {"name": "tenant"}}

View File

@ -312,9 +312,9 @@ class UserGeneratorTestCase(test.ScenarioTestCase):
wrapped_keystone = mock.MagicMock()
mock_keystone.wrap.return_value = wrapped_keystone
endpoint = objects.Endpoint("foo_url", "foo", "foo_pass",
https_insecure=True,
https_cacert="cacert")
endpoint = objects.Credential("foo_url", "foo", "foo_pass",
https_insecure=True,
https_cacert="cacert")
tmp_context = dict(self.context)
tmp_context["config"]["users"] = {"tenants": 1,
"users_per_tenant": 2,
@ -362,8 +362,9 @@ class UserGeneratorTestCase(test.ScenarioTestCase):
@mock.patch("%s.keystone" % CTX)
def test_users_contains_correct_endpoint_type(self, mock_keystone):
endpoint = objects.Endpoint("foo_url", "foo", "foo_pass",
endpoint_type=consts.EndpointType.INTERNAL)
endpoint = objects.Credential(
"foo_url", "foo", "foo_pass",
endpoint_type=consts.EndpointType.INTERNAL)
config = {
"config": {
"users": {
@ -384,7 +385,7 @@ class UserGeneratorTestCase(test.ScenarioTestCase):
@mock.patch("%s.keystone" % CTX)
def test_users_contains_default_endpoint_type(self, mock_keystone):
endpoint = objects.Endpoint("foo_url", "foo", "foo_pass")
endpoint = objects.Credential("foo_url", "foo", "foo_pass")
config = {
"config": {
"users": {