def test_list_ports_fields(self): """List ports: --fields a --fields b -- --fields c d.""" resources = "ports" cmd = port.ListPort(test_cli20.MyApp(sys.stdout), None) self._test_list_resources(resources, cmd, fields_1=['a', 'b'], fields_2=['c', 'd'])
def test_list_ports_sort(self): # list ports: # --sort-key name --sort-key id --sort-key asc --sort-key desc resources = "ports" cmd = port.ListPort(test_cli20.MyApp(sys.stdout), None) self._test_list_resources(resources, cmd, sort_key=["name", "id"], sort_dir=["asc", "desc"])
def test_list_ports_with_fixed_ips_in_csv(self): # List ports: -f csv. resources = "ports" cmd = port.ListPort(test_cli20.MyApp(sys.stdout), None) fixed_ips = [{"subnet_id": "30422057-d6df-4c90-8314-aefb5e326666", "ip_address": "10.0.0.12"}, {"subnet_id": "30422057-d6df-4c90-8314-aefb5e326666", "ip_address": "10.0.0.4"}] contents = [{'name': 'name1', 'fixed_ips': fixed_ips}] self._test_list_resources(resources, cmd, True, response_contents=contents, output_format='csv')
def test_list_ports_detail_tags(self): """List ports: -D -- --tags a b.""" resources = "ports" cmd = port.ListPort(test_cli20.MyApp(sys.stdout), None) self._test_list_resources(resources, cmd, detail=True, tags=['a', 'b'])
def test_list_ports_limit(self): """list ports: -P.""" resources = "ports" cmd = port.ListPort(test_cli20.MyApp(sys.stdout), None) self._test_list_resources(resources, cmd, page_size=1000)
def test_list_ports_pagination(self): resources = "ports" cmd = port.ListPort(test_cli20.MyApp(sys.stdout), None) self._test_list_resources_with_pagination(resources, cmd)
def test_list_ports(self): """List ports: -D.""" resources = "ports" cmd = port.ListPort(test_cli20.MyApp(sys.stdout), None) self._test_list_resources(resources, cmd, True)
def test_list_ports_tags(self): # List ports: -- --tags a b. resources = "ports" cmd = port.ListPort(test_cli20.MyApp(sys.stdout), None) self._test_list_resources(resources, cmd, tags=['a', 'b'])