def test_find_usage_subnets(self): response = result_fixtures.VPC.test_find_usage_subnets mock_conn = Mock() mock_conn.describe_subnets.return_value = response cls = _VpcService(21, 43) cls.conn = mock_conn cls._find_usage_subnets() usage = sorted(cls.limits['Subnets per VPC'].get_current_usage()) assert len(usage) == 2 assert usage[0].get_value() == 1 assert usage[0].resource_id == 'vpc-2' assert usage[1].get_value() == 2 assert usage[1].resource_id == 'vpc-1' assert mock_conn.mock_calls == [call.describe_subnets()]
def test_find_usage_subnets(self): response = result_fixtures.VPC.test_find_usage_subnets mock_conn = Mock() mock_conn.describe_subnets.return_value = response cls = _VpcService(21, 43) cls.conn = mock_conn cls._find_usage_subnets() usage = sorted(cls.limits['Subnets per VPC'].get_current_usage()) assert len(usage) == 2 assert usage[0].get_value() == 1 assert usage[0].resource_id == 'vpc-2' assert usage[1].get_value() == 2 assert usage[1].resource_id == 'vpc-1' assert mock_conn.mock_calls == [ call.describe_subnets() ]
def test_find_usage_subnets(self): response = result_fixtures.VPC.test_find_usage_subnets mock_conn = Mock() mock_conn.describe_subnets.return_value = response cls = _VpcService(21, 43, {}, None) cls._current_account_id = '0123456789' cls.conn = mock_conn res = cls._find_usage_subnets() assert res == {'string': 'string', 'subnet2': 'az3', 'subnet3': 'az2'} usage = sorted(cls.limits['Subnets per VPC'].get_current_usage()) assert len(usage) == 2 assert usage[0].get_value() == 1 assert usage[0].resource_id == 'vpc-2' assert usage[1].get_value() == 2 assert usage[1].resource_id == 'vpc-1' assert mock_conn.mock_calls == [ call.describe_subnets(Filters=[{ 'Name': 'owner-id', 'Values': ['0123456789'] }]) ]