Use assert_called_once_with() instead of assert_called_with()

If one API is only called once, we'd better use assert_called_once_with()
to check the call.

Change-Id: Id05055bb90592d218826732259ed84fc366734ce
This commit is contained in:
Tang Chen 2016-03-19 10:56:43 +08:00
parent 98dc781e94
commit 41853985bb
6 changed files with 65 additions and 58 deletions

View File

@ -54,8 +54,8 @@ class TestDeleteFloatingIPNetwork(TestFloatingIPNetwork):
result = self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
self.network.find_ip.assert_called_with(self.floating_ip.id) self.network.find_ip.assert_called_once_with(self.floating_ip.id)
self.network.delete_ip.assert_called_with(self.floating_ip) self.network.delete_ip.assert_called_once_with(self.floating_ip)
self.assertIsNone(result) self.assertIsNone(result)
@ -95,7 +95,7 @@ class TestListFloatingIPNetwork(TestFloatingIPNetwork):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.ips.assert_called_with(**{}) self.network.ips.assert_called_once_with(**{})
self.assertEqual(self.columns, columns) self.assertEqual(self.columns, columns)
self.assertEqual(self.data, list(data)) self.assertEqual(self.data, list(data))
@ -150,7 +150,7 @@ class TestShowFloatingIPNetwork(TestFloatingIPNetwork):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.find_ip.assert_called_with( self.network.find_ip.assert_called_once_with(
self.floating_ip.id, self.floating_ip.id,
ignore_missing=False ignore_missing=False
) )
@ -198,7 +198,7 @@ class TestDeleteFloatingIPCompute(TestFloatingIPCompute):
result = self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
self.compute.floating_ips.delete.assert_called_with( self.compute.floating_ips.delete.assert_called_once_with(
self.floating_ip.id self.floating_ip.id
) )
self.assertIsNone(result) self.assertIsNone(result)
@ -244,7 +244,7 @@ class TestListFloatingIPCompute(TestFloatingIPCompute):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.compute.floating_ips.list.assert_called_with() self.compute.floating_ips.list.assert_called_once_with()
self.assertEqual(self.columns, columns) self.assertEqual(self.columns, columns)
self.assertEqual(self.data, list(data)) self.assertEqual(self.data, list(data))

View File

@ -124,7 +124,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.create_network.assert_called_with(**{ self.network.create_network.assert_called_once_with(**{
'admin_state_up': True, 'admin_state_up': True,
'name': self._network.name, 'name': self._network.name,
}) })
@ -152,7 +152,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = (self.cmd.take_action(parsed_args)) columns, data = (self.cmd.take_action(parsed_args))
self.network.create_network.assert_called_with(**{ self.network.create_network.assert_called_once_with(**{
'admin_state_up': False, 'admin_state_up': False,
'availability_zone_hints': ["nova"], 'availability_zone_hints': ["nova"],
'name': self._network.name, 'name': self._network.name,
@ -177,7 +177,7 @@ class TestCreateNetworkIdentityV3(TestNetwork):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.create_network.assert_called_with(**{ self.network.create_network.assert_called_once_with(**{
'admin_state_up': True, 'admin_state_up': True,
'name': self._network.name, 'name': self._network.name,
'shared': False, 'shared': False,
@ -258,7 +258,7 @@ class TestCreateNetworkIdentityV2(TestNetwork):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.create_network.assert_called_with(**{ self.network.create_network.assert_called_once_with(**{
'admin_state_up': True, 'admin_state_up': True,
'name': self._network.name, 'name': self._network.name,
'tenant_id': identity_fakes_v2.project_id, 'tenant_id': identity_fakes_v2.project_id,
@ -315,7 +315,7 @@ class TestDeleteNetwork(TestNetwork):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
self.network.delete_network.assert_called_with(self._network) self.network.delete_network.assert_called_once_with(self._network)
self.assertIsNone(result) self.assertIsNone(result)
@ -386,7 +386,7 @@ class TestListNetwork(TestNetwork):
# containing the data to be listed. # containing the data to be listed.
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.networks.assert_called_with() self.network.networks.assert_called_once_with()
self.assertEqual(self.columns, columns) self.assertEqual(self.columns, columns)
self.assertEqual(self.data, list(data)) self.assertEqual(self.data, list(data))
@ -405,7 +405,7 @@ class TestListNetwork(TestNetwork):
# containing the data to be listed. # containing the data to be listed.
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.networks.assert_called_with( self.network.networks.assert_called_once_with(
**{'router:external': True} **{'router:external': True}
) )
self.assertEqual(self.columns, columns) self.assertEqual(self.columns, columns)
@ -426,7 +426,7 @@ class TestListNetwork(TestNetwork):
# containing the data to be listed. # containing the data to be listed.
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.networks.assert_called_with() self.network.networks.assert_called_once_with()
self.assertEqual(self.columns_long, columns) self.assertEqual(self.columns_long, columns)
self.assertEqual(self.data_long, list(data)) self.assertEqual(self.data_long, list(data))
@ -468,7 +468,8 @@ class TestSetNetwork(TestNetwork):
'admin_state_up': True, 'admin_state_up': True,
'shared': True, 'shared': True,
} }
self.network.update_network.assert_called_with(self._network, **attrs) self.network.update_network.assert_called_once_with(
self._network, **attrs)
self.assertIsNone(result) self.assertIsNone(result)
def test_set_that(self): def test_set_that(self):
@ -490,7 +491,8 @@ class TestSetNetwork(TestNetwork):
'admin_state_up': False, 'admin_state_up': False,
'shared': False, 'shared': False,
} }
self.network.update_network.assert_called_with(self._network, **attrs) self.network.update_network.assert_called_once_with(
self._network, **attrs)
self.assertIsNone(result) self.assertIsNone(result)
def test_set_nothing(self): def test_set_nothing(self):
@ -558,8 +560,8 @@ class TestShowNetwork(TestNetwork):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.find_network.assert_called_with(self._network.name, self.network.find_network.assert_called_once_with(
ignore_missing=False) self._network.name, ignore_missing=False)
self.assertEqual(tuple(self.columns), columns) self.assertEqual(tuple(self.columns), columns)
self.assertEqual(list(self.data), list(data)) self.assertEqual(list(self.data), list(data))
@ -682,7 +684,7 @@ class TestCreateNetworkCompute(TestNetworkCompute):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.compute.networks.create.assert_called_with(**{ self.compute.networks.create.assert_called_once_with(**{
'cidr': self._network.cidr, 'cidr': self._network.cidr,
'label': self._network.label, 'label': self._network.label,
}) })
@ -719,7 +721,7 @@ class TestDeleteNetworkCompute(TestNetworkCompute):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
self.compute.networks.delete.assert_called_with(self._network.id) self.compute.networks.delete.assert_called_once_with(self._network.id)
self.assertIsNone(result) self.assertIsNone(result)
@ -765,7 +767,7 @@ class TestListNetworkCompute(TestNetworkCompute):
# containing the data to be listed. # containing the data to be listed.
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.compute.networks.list.assert_called_with() self.compute.networks.list.assert_called_once_with()
self.assertEqual(self.columns, columns) self.assertEqual(self.columns, columns)
self.assertEqual(self.data, list(data)) self.assertEqual(self.data, list(data))

View File

@ -110,7 +110,7 @@ class TestCreatePort(TestPort):
columns, data = (self.cmd.take_action(parsed_args)) columns, data = (self.cmd.take_action(parsed_args))
self.network.create_port.assert_called_with(**{ self.network.create_port.assert_called_once_with(**{
'admin_state_up': True, 'admin_state_up': True,
'network_id': self._port.network_id, 'network_id': self._port.network_id,
'name': 'test-port', 'name': 'test-port',
@ -154,7 +154,7 @@ class TestCreatePort(TestPort):
columns, data = (self.cmd.take_action(parsed_args)) columns, data = (self.cmd.take_action(parsed_args))
self.network.create_port.assert_called_with(**{ self.network.create_port.assert_called_once_with(**{
'mac_address': 'aa:aa:aa:aa:aa:aa', 'mac_address': 'aa:aa:aa:aa:aa:aa',
'fixed_ips': [{'subnet_id': self.fake_subnet.id, 'fixed_ips': [{'subnet_id': self.fake_subnet.id,
'ip_address': '10.0.0.2'}], 'ip_address': '10.0.0.2'}],
@ -195,7 +195,7 @@ class TestDeletePort(TestPort):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
self.network.delete_port.assert_called_with(self._port) self.network.delete_port.assert_called_once_with(self._port)
self.assertIsNone(result) self.assertIsNone(result)
@ -238,7 +238,7 @@ class TestListPort(TestPort):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.ports.assert_called_with() self.network.ports.assert_called_once_with()
self.assertEqual(self.columns, columns) self.assertEqual(self.columns, columns)
self.assertEqual(self.data, list(data)) self.assertEqual(self.data, list(data))
@ -255,7 +255,7 @@ class TestListPort(TestPort):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.ports.assert_called_with(**{ self.network.ports.assert_called_once_with(**{
'device_id': 'fake-router-id' 'device_id': 'fake-router-id'
}) })
self.assertEqual(self.columns, columns) self.assertEqual(self.columns, columns)
@ -292,7 +292,7 @@ class TestSetPort(TestPort):
attrs = { attrs = {
'fixed_ips': [{'ip_address': '10.0.0.11'}], 'fixed_ips': [{'ip_address': '10.0.0.11'}],
} }
self.network.update_port.assert_called_with(self._port, **attrs) self.network.update_port.assert_called_once_with(self._port, **attrs)
self.assertIsNone(result) self.assertIsNone(result)
def test_set_this(self): def test_set_this(self):
@ -310,7 +310,7 @@ class TestSetPort(TestPort):
attrs = { attrs = {
'admin_state_up': False, 'admin_state_up': False,
} }
self.network.update_port.assert_called_with(self._port, **attrs) self.network.update_port.assert_called_once_with(self._port, **attrs)
self.assertIsNone(result) self.assertIsNone(result)
def test_set_that(self): def test_set_that(self):
@ -337,7 +337,7 @@ class TestSetPort(TestPort):
'binding:profile': {'foo': 'bar'}, 'binding:profile': {'foo': 'bar'},
'binding:host_id': 'binding-host-id-xxxx', 'binding:host_id': 'binding-host-id-xxxx',
} }
self.network.update_port.assert_called_with(self._port, **attrs) self.network.update_port.assert_called_once_with(self._port, **attrs)
self.assertIsNone(result) self.assertIsNone(result)
@ -372,8 +372,8 @@ class TestShowPort(TestPort):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.find_port.assert_called_with(self._port.name, self.network.find_port.assert_called_once_with(
ignore_missing=False) self._port.name, ignore_missing=False)
ref_columns, ref_data = self._get_common_cols_data(self._port) ref_columns, ref_data = self._get_common_cols_data(self._port)
self.assertEqual(ref_columns, columns) self.assertEqual(ref_columns, columns)

View File

@ -80,7 +80,7 @@ class TestCreateRouter(TestRouter):
columns, data = (self.cmd.take_action(parsed_args)) columns, data = (self.cmd.take_action(parsed_args))
self.network.create_router.assert_called_with(**{ self.network.create_router.assert_called_once_with(**{
'admin_state_up': True, 'admin_state_up': True,
'name': self.new_router.name, 'name': self.new_router.name,
'distributed': False, 'distributed': False,
@ -103,7 +103,7 @@ class TestCreateRouter(TestRouter):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = (self.cmd.take_action(parsed_args)) columns, data = (self.cmd.take_action(parsed_args))
self.network.create_router.assert_called_with(**{ self.network.create_router.assert_called_once_with(**{
'admin_state_up': True, 'admin_state_up': True,
'name': self.new_router.name, 'name': self.new_router.name,
'distributed': False, 'distributed': False,
@ -139,7 +139,7 @@ class TestDeleteRouter(TestRouter):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
self.network.delete_router.assert_called_with(self._router) self.network.delete_router.assert_called_once_with(self._router)
self.assertIsNone(result) self.assertIsNone(result)
@ -205,7 +205,7 @@ class TestListRouter(TestRouter):
# containing the data to be listed. # containing the data to be listed.
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.routers.assert_called_with() self.network.routers.assert_called_once_with()
self.assertEqual(self.columns, columns) self.assertEqual(self.columns, columns)
self.assertEqual(self.data, list(data)) self.assertEqual(self.data, list(data))
@ -223,7 +223,7 @@ class TestListRouter(TestRouter):
# containing the data to be listed. # containing the data to be listed.
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.routers.assert_called_with() self.network.routers.assert_called_once_with()
self.assertEqual(self.columns_long, columns) self.assertEqual(self.columns_long, columns)
self.assertEqual(self.data_long, list(data)) self.assertEqual(self.data_long, list(data))
@ -265,7 +265,8 @@ class TestSetRouter(TestRouter):
'distributed': True, 'distributed': True,
'name': 'noob', 'name': 'noob',
} }
self.network.update_router.assert_called_with(self._router, **attrs) self.network.update_router.assert_called_once_with(
self._router, **attrs)
self.assertIsNone(result) self.assertIsNone(result)
def test_set_that(self): def test_set_that(self):
@ -287,7 +288,8 @@ class TestSetRouter(TestRouter):
'admin_state_up': False, 'admin_state_up': False,
'distributed': False, 'distributed': False,
} }
self.network.update_router.assert_called_with(self._router, **attrs) self.network.update_router.assert_called_once_with(
self._router, **attrs)
self.assertIsNone(result) self.assertIsNone(result)
def test_set_distributed_centralized(self): def test_set_distributed_centralized(self):
@ -324,7 +326,8 @@ class TestSetRouter(TestRouter):
'routes': [{'destination': '10.20.30.0/24', 'routes': [{'destination': '10.20.30.0/24',
'gateway': '10.20.30.1'}], 'gateway': '10.20.30.1'}],
} }
self.network.update_router.assert_called_with(self._router, **attrs) self.network.update_router.assert_called_once_with(
self._router, **attrs)
self.assertIsNone(result) self.assertIsNone(result)
def test_set_clear_routes(self): def test_set_clear_routes(self):
@ -343,7 +346,8 @@ class TestSetRouter(TestRouter):
attrs = { attrs = {
'routes': [], 'routes': [],
} }
self.network.update_router.assert_called_with(self._router, **attrs) self.network.update_router.assert_called_once_with(
self._router, **attrs)
self.assertIsNone(result) self.assertIsNone(result)
def test_set_route_clear_routes(self): def test_set_route_clear_routes(self):
@ -422,7 +426,7 @@ class TestShowRouter(TestRouter):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.find_router.assert_called_with(self._router.name, self.network.find_router.assert_called_once_with(
ignore_missing=False) self._router.name, ignore_missing=False)
self.assertEqual(tuple(self.columns), columns) self.assertEqual(tuple(self.columns), columns)
self.assertEqual(self.data, data) self.assertEqual(self.data, data)

View File

@ -219,7 +219,7 @@ class TestCreateSubnet(TestSubnet):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.create_subnet.assert_called_with(**{ self.network.create_subnet.assert_called_once_with(**{
'cidr': self._subnet.cidr, 'cidr': self._subnet.cidr,
'enable_dhcp': self._subnet.enable_dhcp, 'enable_dhcp': self._subnet.enable_dhcp,
'ip_version': self._subnet.ip_version, 'ip_version': self._subnet.ip_version,
@ -275,7 +275,7 @@ class TestCreateSubnet(TestSubnet):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.create_subnet.assert_called_with(**{ self.network.create_subnet.assert_called_once_with(**{
'dns_nameservers': self._subnet_from_pool.dns_nameservers, 'dns_nameservers': self._subnet_from_pool.dns_nameservers,
'enable_dhcp': self._subnet_from_pool.enable_dhcp, 'enable_dhcp': self._subnet_from_pool.enable_dhcp,
'gateway_ip': self._subnet_from_pool.gateway_ip, 'gateway_ip': self._subnet_from_pool.gateway_ip,
@ -341,7 +341,7 @@ class TestCreateSubnet(TestSubnet):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.create_subnet.assert_called_with(**{ self.network.create_subnet.assert_called_once_with(**{
'cidr': self._subnet_ipv6.cidr, 'cidr': self._subnet_ipv6.cidr,
'dns_nameservers': self._subnet_ipv6.dns_nameservers, 'dns_nameservers': self._subnet_ipv6.dns_nameservers,
'enable_dhcp': self._subnet_ipv6.enable_dhcp, 'enable_dhcp': self._subnet_ipv6.enable_dhcp,
@ -383,7 +383,7 @@ class TestDeleteSubnet(TestSubnet):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
self.network.delete_subnet.assert_called_with(self._subnet) self.network.delete_subnet.assert_called_once_with(self._subnet)
self.assertIsNone(result) self.assertIsNone(result)
@ -449,7 +449,7 @@ class TestListSubnet(TestSubnet):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.subnets.assert_called_with() self.network.subnets.assert_called_once_with()
self.assertEqual(self.columns, columns) self.assertEqual(self.columns, columns)
self.assertEqual(self.data, list(data)) self.assertEqual(self.data, list(data))
@ -464,7 +464,7 @@ class TestListSubnet(TestSubnet):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.subnets.assert_called_with() self.network.subnets.assert_called_once_with()
self.assertEqual(self.columns_long, columns) self.assertEqual(self.columns_long, columns)
self.assertEqual(self.data_long, list(data)) self.assertEqual(self.data_long, list(data))
@ -535,8 +535,8 @@ class TestShowSubnet(TestSubnet):
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.find_subnet.assert_called_with(self._subnet.name, self.network.find_subnet.assert_called_once_with(
ignore_missing=False) self._subnet.name, ignore_missing=False)
self.assertEqual(self.columns, columns) self.assertEqual(self.columns, columns)
self.assertEqual(list(self.data), list(data)) self.assertEqual(list(self.data), list(data))

View File

@ -94,7 +94,7 @@ class TestCreateSubnetPool(TestSubnetPool):
columns, data = (self.cmd.take_action(parsed_args)) columns, data = (self.cmd.take_action(parsed_args))
self.network.create_subnet_pool.assert_called_with(**{ self.network.create_subnet_pool.assert_called_once_with(**{
'prefixes': ['10.0.10.0/24'], 'prefixes': ['10.0.10.0/24'],
'name': self._subnet_pool.name, 'name': self._subnet_pool.name,
}) })
@ -118,7 +118,7 @@ class TestCreateSubnetPool(TestSubnetPool):
columns, data = (self.cmd.take_action(parsed_args)) columns, data = (self.cmd.take_action(parsed_args))
self.network.create_subnet_pool.assert_called_with(**{ self.network.create_subnet_pool.assert_called_once_with(**{
'default_prefix_length': self._subnet_pool.default_prefixlen, 'default_prefix_length': self._subnet_pool.default_prefixlen,
'max_prefix_length': self._subnet_pool.max_prefixlen, 'max_prefix_length': self._subnet_pool.max_prefixlen,
'min_prefix_length': self._subnet_pool.min_prefixlen, 'min_prefix_length': self._subnet_pool.min_prefixlen,
@ -169,7 +169,8 @@ class TestDeleteSubnetPool(TestSubnetPool):
result = self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
self.network.delete_subnet_pool.assert_called_with(self._subnet_pool) self.network.delete_subnet_pool.assert_called_once_with(
self._subnet_pool)
self.assertIsNone(result) self.assertIsNone(result)
@ -222,7 +223,7 @@ class TestListSubnetPool(TestSubnetPool):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.subnet_pools.assert_called_with() self.network.subnet_pools.assert_called_once_with()
self.assertEqual(self.columns, columns) self.assertEqual(self.columns, columns)
self.assertEqual(self.data, list(data)) self.assertEqual(self.data, list(data))
@ -237,7 +238,7 @@ class TestListSubnetPool(TestSubnetPool):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.subnet_pools.assert_called_with() self.network.subnet_pools.assert_called_once_with()
self.assertEqual(self.columns_long, columns) self.assertEqual(self.columns_long, columns)
self.assertEqual(self.data_long, list(data)) self.assertEqual(self.data_long, list(data))
@ -280,7 +281,7 @@ class TestSetSubnetPool(TestSubnetPool):
'default_prefix_length': '8', 'default_prefix_length': '8',
'min_prefix_length': '8', 'min_prefix_length': '8',
} }
self.network.update_subnet_pool.assert_called_with( self.network.update_subnet_pool.assert_called_once_with(
self._subnet_pool, **attrs) self._subnet_pool, **attrs)
self.assertIsNone(result) self.assertIsNone(result)
@ -306,7 +307,7 @@ class TestSetSubnetPool(TestSubnetPool):
'prefixes': prefixes, 'prefixes': prefixes,
'max_prefix_length': '16', 'max_prefix_length': '16',
} }
self.network.update_subnet_pool.assert_called_with( self.network.update_subnet_pool.assert_called_once_with(
self._subnet_pool, **attrs) self._subnet_pool, **attrs)
self.assertIsNone(result) self.assertIsNone(result)
@ -396,7 +397,7 @@ class TestShowSubnetPool(TestSubnetPool):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
self.network.find_subnet_pool.assert_called_with( self.network.find_subnet_pool.assert_called_once_with(
self._subnet_pool.name, self._subnet_pool.name,
ignore_missing=False ignore_missing=False
) )