diff --git a/senlin_dashboard/api/senlin.py b/senlin_dashboard/api/senlin.py index 41e011d5..f70f442e 100644 --- a/senlin_dashboard/api/senlin.py +++ b/senlin_dashboard/api/senlin.py @@ -15,19 +15,18 @@ from django.conf import settings from horizon.utils import memoized from openstack_dashboard.api import base from senlinclient import client as senlin_client -from senlinclient.v1 import models USER_AGENT = 'python-senlinclient' class Cluster(base.APIResourceWrapper): - _attrs = ['id', 'name', 'status', 'created_time', 'updated_time', + _attrs = ['id', 'name', 'status', 'created_at', 'updated_at', 'profile_name', 'profile_id', 'status_reason'] class Profile(base.APIResourceWrapper): - _attrs = ['id', 'name', 'type', 'created_time', 'updated_time', - 'permission'] + _attrs = ['id', 'name', 'type_name', 'created_at', 'updated_at', + 'permission', 'metadata', 'spec'] class ProfileType(base.APIResourceWrapper): @@ -36,11 +35,11 @@ class ProfileType(base.APIResourceWrapper): class Policy(base.APIResourceWrapper): _attrs = ['id', 'name', 'type', 'spec', 'level', 'cooldown', - 'created_time', 'updated_time'] + 'created_at', 'updated_at'] class Node(base.APIResourceWrapper): - _attrs = ['id', 'name', 'status', 'created_time', 'updated_time', + _attrs = ['id', 'name', 'status', 'created_at', 'updated_at', 'profile_name', 'status_reason', 'physical_id', 'role', 'profile_id', 'profile_url'] @@ -56,117 +55,112 @@ def senlinclient(request): kwargs = { 'auth_url': getattr(settings, 'OPENSTACK_KEYSTONE_URL'), 'token': request.user.token.id, + 'user_id': request.user.id, 'project_id': request.user.tenant_id, + 'auth_plugin': 'token', } return senlin_client.Client(api_version, {}, USER_AGENT, **kwargs) -def cluster_list(request): +def cluster_list(request, params): """Returns all clusters.""" - clusters = senlinclient(request).list(models.Cluster) + clusters = senlinclient(request).clusters(**params) return [Cluster(c) for c in clusters] def cluster_create(request, params): """Create cluster.""" - cluster = senlinclient(request).create(models.Cluster, params) - return cluster - - -def cluster_delete(request, cluster_id): - """Delete cluster.""" - senlinclient(request).delete(models.Cluster, {"id": cluster_id}) - - -def cluster_get(request, cluster_id): - """Returns cluster.""" - cluster = senlinclient(request).get(models.Cluster, {"id": cluster_id}) + cluster = senlinclient(request).create_cluster(**params) return Cluster(cluster) -def profile_list(request): +def cluster_delete(request, cluster): + """Delete cluster.""" + senlinclient(request).delete_cluster(cluster) + + +def cluster_get(request, cluster): + """Returns cluster.""" + cluster = senlinclient(request).get_cluster(cluster) + return Cluster(cluster) + + +def profile_list(request, params): """Returns all profiles.""" - profiles = senlinclient(request).list(models.Profile) + profiles = senlinclient(request).profiles(**params) return [Profile(p) for p in profiles] -def profile_type_list(request): - """Returns all profile types.""" - prof_types = senlinclient(request).list(models.ProfileType) - return [ProfileType(t) for t in prof_types] - - -def profile_get(request, profile_id): +def profile_get(request, profile): """Returns profile.""" - profile = senlinclient(request).get(models.Profile, {"id": profile_id}) - return profile + profile = senlinclient(request).get_profile(profile) + return Profile(profile) -def profile_create(request, opts): +def profile_create(request, params): """Create profile.""" - profile = senlinclient(request).create(models.Profile, opts) - return profile + profile = senlinclient(request).create_profile(**params) + return Profile(profile) -def profile_update(request, opts): +def profile_update(request, profile, params): """Update profile.""" - - profile = senlinclient(request).update(models.Profile, opts) - return profile + profile = senlinclient(request).update_profile(profile, **params) + return Profile(profile) -def profile_delete(request, profile_id): +def profile_delete(request, profile): """Delete profile.""" - senlinclient(request).delete(models.Profile, {"id": profile_id}) + senlinclient(request).delete_profile(profile) -def policy_list(request): +def policy_list(request, params): """Returns all policies.""" - policies = senlinclient(request).list(models.Policy) + policies = senlinclient(request).policies(**params) return [Policy(p) for p in policies] -def policy_create(request, args): +def policy_create(request, params): """Create a policy.""" - policy = senlinclient(request).create(models.Policy, args) + policy = senlinclient(request).create_policy(**params) return policy -def policy_delete(request, policy_id): +def policy_delete(request, policy): """Delete a policy.""" - senlinclient(request).delete(models.Policy, {"id": policy_id}) + senlinclient(request).delete_policy(policy) -def policy_get(request, policy_id): +def policy_get(request, policy): """Returns policy.""" - policy = senlinclient(request).get(models.Policy, {"id": policy_id}) + policy = senlinclient(request).get_policy(policy) return policy -def node_list(request): +def node_list(request, params): """Returns all nodes.""" - nodes = senlinclient(request).list(models.Node) + nodes = senlinclient(request).nodes(**params) return [Node(p) for p in nodes] def node_create(request, params): """Create node.""" - node = senlinclient(request).create(models.Node, params) + node = senlinclient(request).create_node(**params) return node -def node_delete(request, node_id): +def node_delete(request, node): """Delete node.""" - senlinclient(request).delete(models.Node, {"id": node_id}) + senlinclient(request).delete_node(node) -def node_get(request, node_id): +def node_get(request, node): """Returns node.""" - node = senlinclient(request).get(models.Node, {"id": node_id}) + node = senlinclient(request).get_node(node) return Node(node) -def event_list(request, **kwargs): +def event_list(request, params): """Returns events.""" - events = senlinclient(request).list(models.Event, **kwargs) + events = senlinclient(request).events(**params) return [Event(c) for c in events] diff --git a/senlin_dashboard/cluster/clusters/forms.py b/senlin_dashboard/cluster/clusters/forms.py index f6428d6c..03e3f1a7 100644 --- a/senlin_dashboard/cluster/clusters/forms.py +++ b/senlin_dashboard/cluster/clusters/forms.py @@ -64,7 +64,7 @@ class CreateForm(forms.SelfHandlingForm): def __init__(self, request, *args, **kwargs): super(CreateForm, self).__init__(request, *args, **kwargs) - profiles = senlin.profile_list(request) + profiles = senlin.profile_list(request, params={}) self.fields['profile_id'].choices = [(profile.id, profile.name) for profile in profiles] diff --git a/senlin_dashboard/cluster/clusters/tables.py b/senlin_dashboard/cluster/clusters/tables.py index fc5030c1..cc0e1e18 100644 --- a/senlin_dashboard/cluster/clusters/tables.py +++ b/senlin_dashboard/cluster/clusters/tables.py @@ -36,7 +36,7 @@ def get_profile_link(cluster): def get_updated_time(object): - return filters.parse_isotime(object.updated_time) or None + return filters.parse_isotime(object.updated_at) or None class DeleteCluster(tables.DeleteAction): @@ -111,7 +111,7 @@ class ClustersTable(tables.DataTable): link=get_profile_link, verbose_name=_("Profile Name")) created = tables.Column( - "created_time", + "created_at", verbose_name=_("Created"), filters=( filters.parse_isotime, diff --git a/senlin_dashboard/cluster/clusters/templates/clusters/_detail_overview.html b/senlin_dashboard/cluster/clusters/templates/clusters/_detail_overview.html index 44f2e7ab..a6a08ac8 100644 --- a/senlin_dashboard/cluster/clusters/templates/clusters/_detail_overview.html +++ b/senlin_dashboard/cluster/clusters/templates/clusters/_detail_overview.html @@ -13,10 +13,10 @@
{% trans "Status" %}
{{ cluster.status }}
{% trans "Created" context "Created time" %}
-
{{ cluster.created_time|parse_date }}
- {% if cluster.updated_time %} +
{{ cluster.created_at|parse_date }}
+ {% if cluster.updated_at %}
{% trans "Updated" context "Updated time" %}
-
{{ cluster.updated_time|parse_date }}
+
{{ cluster.updated_at|parse_date }}
{% endif %} diff --git a/senlin_dashboard/cluster/clusters/tests.py b/senlin_dashboard/cluster/clusters/tests.py index 999aa83a..3a42f1e4 100644 --- a/senlin_dashboard/cluster/clusters/tests.py +++ b/senlin_dashboard/cluster/clusters/tests.py @@ -31,7 +31,7 @@ class ClustersTest(test.TestCase): def test_index(self): clusters = self.clusters.list() api.senlin.cluster_list( - IsA(http.HttpRequest)).AndReturn(clusters) + IsA(http.HttpRequest), params={}).AndReturn(clusters) self.mox.ReplayAll() res = self.client.get(CLUSTER_INDEX_URL) @@ -42,7 +42,7 @@ class ClustersTest(test.TestCase): @test.create_stubs({api.senlin: ('cluster_list',)}) def test_index_cluster_list_exception(self): api.senlin.cluster_list( - IsA(http.HttpRequest)).AndRaise(self.exceptions.senlin) + IsA(http.HttpRequest), params={}).AndRaise(self.exceptions.senlin) self.mox.ReplayAll() res = self.client.get(CLUSTER_INDEX_URL) @@ -53,7 +53,7 @@ class ClustersTest(test.TestCase): @test.create_stubs({api.senlin: ('cluster_list',)}) def test_index_no_cluster(self): api.senlin.cluster_list( - IsA(http.HttpRequest)).AndReturn([]) + IsA(http.HttpRequest), params={}).AndReturn([]) self.mox.ReplayAll() res = self.client.get(CLUSTER_INDEX_URL) @@ -81,7 +81,7 @@ class ClustersTest(test.TestCase): opts = formdata api.senlin.profile_list( - IsA(http.HttpRequest)).AndReturn(profiles) + IsA(http.HttpRequest), params={}).AndReturn(profiles) api.senlin.cluster_create( IsA(http.HttpRequest), opts).AndReturn(cluster) self.mox.ReplayAll() diff --git a/senlin_dashboard/cluster/clusters/views.py b/senlin_dashboard/cluster/clusters/views.py index bb92bb4f..246cf6dd 100644 --- a/senlin_dashboard/cluster/clusters/views.py +++ b/senlin_dashboard/cluster/clusters/views.py @@ -32,7 +32,8 @@ class IndexView(tables.DataTableView): def get_data(self): try: - clusters = senlin.cluster_list(self.request) + params = {} + clusters = senlin.cluster_list(self.request, params) except Exception: clusters = [] exceptions.handle(self.request, diff --git a/senlin_dashboard/cluster/nodes/forms.py b/senlin_dashboard/cluster/nodes/forms.py index ea178f60..9ea71d00 100644 --- a/senlin_dashboard/cluster/nodes/forms.py +++ b/senlin_dashboard/cluster/nodes/forms.py @@ -46,12 +46,12 @@ class CreateForm(forms.SelfHandlingForm): def __init__(self, request, *args, **kwargs): super(CreateForm, self).__init__(request, *args, **kwargs) - profiles = senlin.profile_list(request) + profiles = senlin.profile_list(request, params={}) self.fields['profile_id'].choices = ( [("", _("Select Profile"))] + [(profile.id, profile.name) for profile in profiles]) - clusters = senlin.cluster_list(request) + clusters = senlin.cluster_list(request, params={}) self.fields['cluster_id'].choices = ( [("", _("Select Cluster"))] + [(cluster.id, cluster.name) for cluster in clusters]) diff --git a/senlin_dashboard/cluster/nodes/tables.py b/senlin_dashboard/cluster/nodes/tables.py index 71b5b874..2ab939de 100644 --- a/senlin_dashboard/cluster/nodes/tables.py +++ b/senlin_dashboard/cluster/nodes/tables.py @@ -72,7 +72,7 @@ def get_physical_link(node): def get_updated_time(object): - return filters.parse_isotime(object.updated_time) or None + return filters.parse_isotime(object.updated_at) or None class NodesTable(tables.DataTable): @@ -115,7 +115,7 @@ class NodesTable(tables.DataTable): status_reason = tables.Column("status_reason", verbose_name=_("Status Reason")) created = tables.Column( - "created_time", + "created_at", verbose_name=_("Created"), filters=( filters.parse_isotime, diff --git a/senlin_dashboard/cluster/nodes/templates/nodes/_detail_overview.html b/senlin_dashboard/cluster/nodes/templates/nodes/_detail_overview.html index d3ff3ac5..fe590925 100644 --- a/senlin_dashboard/cluster/nodes/templates/nodes/_detail_overview.html +++ b/senlin_dashboard/cluster/nodes/templates/nodes/_detail_overview.html @@ -19,10 +19,10 @@
{{ node.role }}
{% endif %}
{% trans "Created" context "Created time" %}
-
{{ node.created_time|parse_date }}
- {% if node.updated_time %} +
{{ node.created_at|parse_date }}
+ {% if node.updated_at %}
{% trans "Updated" context "Updated time" %}
-
{{ node.updated_time|parse_date }}
+
{{ node.updated_at|parse_date }}
{% endif %} diff --git a/senlin_dashboard/cluster/nodes/tests.py b/senlin_dashboard/cluster/nodes/tests.py index 1db9c0b5..ed9390cf 100644 --- a/senlin_dashboard/cluster/nodes/tests.py +++ b/senlin_dashboard/cluster/nodes/tests.py @@ -31,7 +31,7 @@ class NodesTest(test.TestCase): def test_index(self): nodes = self.nodes.list() api.senlin.node_list( - IsA(http.HttpRequest)).AndReturn(nodes) + IsA(http.HttpRequest), params={}).AndReturn(nodes) self.mox.ReplayAll() res = self.client.get(NODE_INDEX_URL) @@ -42,7 +42,7 @@ class NodesTest(test.TestCase): @test.create_stubs({api.senlin: ('node_list',)}) def test_index_node_list_exception(self): api.senlin.node_list( - IsA(http.HttpRequest)).AndRaise(self.exceptions.senlin) + IsA(http.HttpRequest), params={}).AndRaise(self.exceptions.senlin) self.mox.ReplayAll() res = self.client.get(NODE_INDEX_URL) @@ -52,7 +52,7 @@ class NodesTest(test.TestCase): @test.create_stubs({api.senlin: ('node_list',)}) def test_index_no_node(self): api.senlin.node_list( - IsA(http.HttpRequest)).AndReturn([]) + IsA(http.HttpRequest), params={}).AndReturn([]) self.mox.ReplayAll() res = self.client.get(NODE_INDEX_URL) @@ -79,9 +79,9 @@ class NodesTest(test.TestCase): opts = formdata api.senlin.profile_list( - IsA(http.HttpRequest)).AndReturn(profiles) + IsA(http.HttpRequest), params={}).AndReturn(profiles) api.senlin.cluster_list( - IsA(http.HttpRequest)).AndReturn(clusters) + IsA(http.HttpRequest), params={}).AndReturn(clusters) api.senlin.node_create( IsA(http.HttpRequest), opts).AndReturn(node) self.mox.ReplayAll() diff --git a/senlin_dashboard/cluster/nodes/views.py b/senlin_dashboard/cluster/nodes/views.py index 8b4f847c..b8a2d322 100644 --- a/senlin_dashboard/cluster/nodes/views.py +++ b/senlin_dashboard/cluster/nodes/views.py @@ -32,7 +32,8 @@ class IndexView(tables.DataTableView): def get_data(self): try: - nodes = senlin.node_list(self.request) + params = {} + nodes = senlin.node_list(self.request, params) except Exception: nodes = [] exceptions.handle(self.request, diff --git a/senlin_dashboard/cluster/policies/tables.py b/senlin_dashboard/cluster/policies/tables.py index febf39bf..848b50fa 100644 --- a/senlin_dashboard/cluster/policies/tables.py +++ b/senlin_dashboard/cluster/policies/tables.py @@ -51,17 +51,15 @@ class DeletePolicy(tables.DeleteAction): def get_updated_time(object): - return filters.parse_isotime(object.updated_time) or None + return filters.parse_isotime(object.updated_at) or None class PoliciesTable(tables.DataTable): name = tables.Column("name", verbose_name=_("Name"), link=policies_forms.DETAIL_URL) type = tables.Column("type", verbose_name=_("Type")) - level = tables.Column("level", verbose_name=_("Level")) - cooldown = tables.Column("cooldown", verbose_name=_("Cooldown")) created = tables.Column( - "created_time", + "created_at", verbose_name=_("Created"), filters=( filters.parse_isotime, @@ -78,4 +76,3 @@ class PoliciesTable(tables.DataTable): table_actions = (tables.FilterAction, CreatePolicy, DeletePolicy,) - row_actions = (DeletePolicy,) diff --git a/senlin_dashboard/cluster/policies/tests.py b/senlin_dashboard/cluster/policies/tests.py index 50e7b01a..d05e774f 100644 --- a/senlin_dashboard/cluster/policies/tests.py +++ b/senlin_dashboard/cluster/policies/tests.py @@ -33,7 +33,7 @@ class PoliciesTest(test.TestCase): def test_index(self): policies = self.policies.list() api.senlin.policy_list( - IsA(http.HttpRequest)).AndReturn(policies) + IsA(http.HttpRequest), params={}).AndReturn(policies) self.mox.ReplayAll() res = self.client.get(INDEX_URL) @@ -44,7 +44,7 @@ class PoliciesTest(test.TestCase): @test.create_stubs({api.senlin: ('policy_list',)}) def test_index_policy_list_exception(self): api.senlin.policy_list( - IsA(http.HttpRequest)).AndRaise(self.exceptions.senlin) + IsA(http.HttpRequest), params={}).AndRaise(self.exceptions.senlin) self.mox.ReplayAll() res = self.client.get(INDEX_URL) @@ -55,7 +55,7 @@ class PoliciesTest(test.TestCase): @test.create_stubs({api.senlin: ('policy_list',)}) def test_index_no_policy(self): api.senlin.policy_list( - IsA(http.HttpRequest)).AndReturn([]) + IsA(http.HttpRequest), params={}).AndReturn([]) self.mox.ReplayAll() res = self.client.get(INDEX_URL) diff --git a/senlin_dashboard/cluster/policies/views.py b/senlin_dashboard/cluster/policies/views.py index f0d65650..94ad843f 100644 --- a/senlin_dashboard/cluster/policies/views.py +++ b/senlin_dashboard/cluster/policies/views.py @@ -34,7 +34,8 @@ class IndexView(tables.DataTableView): def get_data(self): try: - policies = senlin.policy_list(self.request) + params = {} + policies = senlin.policy_list(self.request, params) except Exception: policies = [] exceptions.handle(self.request, diff --git a/senlin_dashboard/cluster/profiles/forms.py b/senlin_dashboard/cluster/profiles/forms.py index b0fda742..0c77a35c 100644 --- a/senlin_dashboard/cluster/profiles/forms.py +++ b/senlin_dashboard/cluster/profiles/forms.py @@ -181,7 +181,7 @@ class UpdateProfileForm(forms.SelfHandlingForm): ) try: - senlin.profile_update(request, opts) + senlin.profile_update(request, data.get('profile_id'), opts) messages.success(request, _('Your profile %s has been updated.') % opts['name']) diff --git a/senlin_dashboard/cluster/profiles/tables.py b/senlin_dashboard/cluster/profiles/tables.py index 1ac84e9c..f7287b61 100644 --- a/senlin_dashboard/cluster/profiles/tables.py +++ b/senlin_dashboard/cluster/profiles/tables.py @@ -59,15 +59,15 @@ class DeleteProfile(tables.DeleteAction): def get_updated_time(object): - return filters.parse_isotime(object.updated_time) or None + return filters.parse_isotime(object.updated_at) or None class ProfilesTable(tables.DataTable): name = tables.Column("name", verbose_name=_("Name"), link=profiles_forms.DETAIL_URL) - type = tables.Column("type", verbose_name=_("Type")) + type_name = tables.Column("type_name", verbose_name=_("Type")) created = tables.Column( - "created_time", + "created_at", verbose_name=_("Created"), filters=( filters.parse_isotime, diff --git a/senlin_dashboard/cluster/profiles/templates/profiles/_detail_overview.html b/senlin_dashboard/cluster/profiles/templates/profiles/_detail_overview.html index 48f3d012..cef41118 100644 --- a/senlin_dashboard/cluster/profiles/templates/profiles/_detail_overview.html +++ b/senlin_dashboard/cluster/profiles/templates/profiles/_detail_overview.html @@ -9,7 +9,7 @@
{% trans "ID" %}
{{ profile.profile_id }}
{% trans "Type" %}
-
{{ profile.type }}
+
{{ profile.type_name }}
{% trans "Spec" %}
{{ profile.profile_spec|force_escape|nbsp|linebreaksbr }}
{% if profile.permission %} @@ -17,10 +17,10 @@
{{ profile.permission }}
{% endif %}
{% trans "Created" context "Created time" %}
-
{{ profile.created_time|parse_date }}
- {% if profile.updated_time %} +
{{ profile.created_at|parse_date }}
+ {% if profile.updated_at %}
{% trans "Updated" context "Updated time" %}
-
{{ profile.updated_time|parse_date }}
+
{{ profile.updated_at|parse_date }}
{% endif %} diff --git a/senlin_dashboard/cluster/profiles/tests.py b/senlin_dashboard/cluster/profiles/tests.py index d4a92c9b..2e2f039d 100644 --- a/senlin_dashboard/cluster/profiles/tests.py +++ b/senlin_dashboard/cluster/profiles/tests.py @@ -31,7 +31,7 @@ class ProfilesTest(test.TestCase): def test_index(self): profiles = self.profiles.list() api.senlin.profile_list( - IsA(http.HttpRequest)).AndReturn(profiles) + IsA(http.HttpRequest), params={}).AndReturn(profiles) self.mox.ReplayAll() res = self.client.get(PROFILE_INDEX_URL) @@ -42,7 +42,7 @@ class ProfilesTest(test.TestCase): @test.create_stubs({api.senlin: ('profile_list',)}) def test_index_profile_list_exception(self): api.senlin.profile_list( - IsA(http.HttpRequest)).AndRaise(self.exceptions.senlin) + IsA(http.HttpRequest), params={}).AndRaise(self.exceptions.senlin) self.mox.ReplayAll() res = self.client.get(PROFILE_INDEX_URL) @@ -52,7 +52,7 @@ class ProfilesTest(test.TestCase): @test.create_stubs({api.senlin: ('profile_list',)}) def test_index_no_policy(self): api.senlin.profile_list( - IsA(http.HttpRequest)).AndReturn([]) + IsA(http.HttpRequest), params={}).AndReturn([]) self.mox.ReplayAll() res = self.client.get(PROFILE_INDEX_URL) diff --git a/senlin_dashboard/cluster/profiles/views.py b/senlin_dashboard/cluster/profiles/views.py index e5471d6b..ef275ab0 100644 --- a/senlin_dashboard/cluster/profiles/views.py +++ b/senlin_dashboard/cluster/profiles/views.py @@ -34,7 +34,8 @@ class IndexView(tables.DataTableView): def get_data(self): try: - profiles = senlin.profile_list(self.request) + params = {} + profiles = senlin.profile_list(self.request, params) except Exception: profiles = [] msg = _('Unable to retrieve profiles.') @@ -73,7 +74,7 @@ class UpdateView(forms.ModalFormView): default_flow_style=False) profile_dict = {"profile_id": profile_id, "name": profile.name, - "type": profile.type, + "type": profile.type_name, "spec": yaml.safe_dump( profile.spec, default_flow_style=False), diff --git a/senlin_dashboard/test/api_tests/senlin_tests.py b/senlin_dashboard/test/api_tests/senlin_tests.py index db2d5dcf..8dc7a006 100644 --- a/senlin_dashboard/test/api_tests/senlin_tests.py +++ b/senlin_dashboard/test/api_tests/senlin_tests.py @@ -10,8 +10,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from senlinclient.v1 import models - from senlin_dashboard import api from senlin_dashboard.test import helpers as test @@ -19,46 +17,51 @@ from senlin_dashboard.test import helpers as test class SenlinApiTests(test.APITestCase): def test_cluster_list(self): + params = {} clusters = self.clusters.list() senlinclient = self.stub_senlinclient() - senlinclient.list = self.mox.CreateMockAnything() - senlinclient.list(models.Cluster).AndReturn(clusters) + senlinclient.clusters = self.mox.CreateMockAnything() + senlinclient.clusters(**params).AndReturn(clusters) self.mox.ReplayAll() - api.senlin.cluster_list(self.request) + api.senlin.cluster_list(self.request, params) def test_profile_list(self): + params = {} profiles = self.profiles.list() senlinclient = self.stub_senlinclient() - senlinclient.list = self.mox.CreateMockAnything() - senlinclient.list(models.Profile).AndReturn(profiles) + senlinclient.profiles = self.mox.CreateMockAnything() + senlinclient.profiles(**params).AndReturn(profiles) self.mox.ReplayAll() - api.senlin.profile_list(self.request) + api.senlin.profile_list(self.request, params) def test_policy_list(self): + params = {} policies = self.policies.list() senlinclient = self.stub_senlinclient() - senlinclient.list = self.mox.CreateMockAnything() - senlinclient.list(models.Policy).AndReturn(policies) + senlinclient.policies = self.mox.CreateMockAnything() + senlinclient.policies(**params).AndReturn(policies) self.mox.ReplayAll() - api.senlin.policy_list(self.request) + api.senlin.policy_list(self.request, params) def test_node_list(self): + params = {} nodes = self.nodes.list() senlinclient = self.stub_senlinclient() - senlinclient.list = self.mox.CreateMockAnything() - senlinclient.list(models.Node).AndReturn(nodes) + senlinclient.nodes = self.mox.CreateMockAnything() + senlinclient.nodes(**params).AndReturn(nodes) self.mox.ReplayAll() - api.senlin.node_list(self.request) + api.senlin.node_list(self.request, params) def test_event_list(self): + params = {} events = self.events.list() senlinclient = self.stub_senlinclient() - senlinclient.list = self.mox.CreateMockAnything() - senlinclient.list(models.Event).AndReturn(events) + senlinclient.events = self.mox.CreateMockAnything() + senlinclient.events(**params).AndReturn(events) self.mox.ReplayAll() - api.senlin.event_list(self.request) + api.senlin.event_list(self.request, params)