Merge "tests: cover port with existing sorting/pagination api tests"

This commit is contained in:
Jenkins
2016-05-30 08:29:37 +00:00
committed by Gerrit Code Review
3 changed files with 51 additions and 16 deletions

View File

@@ -488,26 +488,16 @@ class BaseSearchCriteriaTest(BaseNetworkTest):
# This should be defined by subclasses to reflect resource name to test
resource = None
# also test a case when there are multiple resources with the same name
# NOTE(ihrachys): some names, like those starting with an underscore (_)
# are sorted differently depending on whether the plugin implements native
# sorting support, or not. So we avoid any such cases here, sticking to
# alphanumeric. Also test a case when there are multiple resources with the
# same name
resource_names = ('test1', 'abc1', 'test10', '123test') + ('test1',)
list_kwargs = {'shared': False}
force_tenant_isolation = True
@classmethod
def resource_setup(cls):
super(BaseSearchCriteriaTest, cls).resource_setup()
cls.create_method = getattr(cls, 'create_%s' % cls.resource)
# NOTE(ihrachys): some names, like those starting with an underscore
# (_) are sorted differently depending on whether the plugin implements
# native sorting support, or not. So we avoid any such cases here,
# sticking to alphanumeric.
for name in cls.resource_names:
args = {'%s_name' % cls.resource: name}
cls.create_method(**args)
list_kwargs = {}
def list_method(self, *args, **kwargs):
method = getattr(self.client, 'list_%ss' % self.resource)

View File

@@ -95,6 +95,14 @@ class NetworksSearchCriteriaTest(base.BaseSearchCriteriaTest):
resource = 'network'
list_kwargs = {'shared': False}
@classmethod
def resource_setup(cls):
super(NetworksSearchCriteriaTest, cls).resource_setup()
for name in cls.resource_names:
cls.create_network(network_name=name)
@test.attr(type='smoke')
@test.idempotent_id('de27d34a-bd9d-4516-83d6-81ef723f7d0d')
def test_list_sorts_asc(self):

View File

@@ -46,3 +46,40 @@ class PortsTestJSON(base.BaseNetworkTest):
self.create_port(self.network)
self.client.update_subnet(s['id'], enable_dhcp=True)
self.create_port(self.network)
class PortsSearchCriteriaTest(base.BaseSearchCriteriaTest):
resource = 'port'
@classmethod
def resource_setup(cls):
super(PortsSearchCriteriaTest, cls).resource_setup()
net = cls.create_network(network_name='port-search-test-net')
for name in cls.resource_names:
cls.create_port(net, name=name)
@test.attr(type='smoke')
@test.idempotent_id('9ab73df4-960a-4ae3-87d3-60992b8d3e2d')
def test_list_sorts_asc(self):
self._test_list_sorts_asc()
@test.attr(type='smoke')
@test.idempotent_id('b426671d-7270-430f-82ff-8f33eec93010')
def test_list_sorts_desc(self):
self._test_list_sorts_desc()
@test.attr(type='smoke')
@test.idempotent_id('a202fdc8-6616-45df-b6a0-463932de6f94')
def test_list_pagination(self):
self._test_list_pagination()
@test.attr(type='smoke')
@test.idempotent_id('f4723b8e-8186-4b9a-bf9e-57519967e048')
def test_list_pagination_with_marker(self):
self._test_list_pagination_with_marker()
@test.attr(type='smoke')
@test.idempotent_id('3afe7024-77ab-4cfe-824b-0b2bf4217727')
def test_list_no_pagination_limit_0(self):
self._test_list_no_pagination_limit_0()