Beispiel #1
0
    def test_update_limits_from_api(self):
        r1 = result_fixtures.ELB.test_update_limits_elb
        r2 = result_fixtures.ELB.test_update_limits_alb

        mock_conn = Mock()
        mock_conn.describe_account_limits.return_value = r1

        with patch('%s.connect' % pb) as mock_connect:
            with patch('%s.client' % pbm) as mock_client:
                m_cli = mock_client.return_value
                m_cli._client_config.region_name = PropertyMock(
                    return_value='rname')
                m_cli.describe_account_limits.return_value = r2
                cls = _ElbService(21, 43)
                cls.conn = mock_conn
                cls._boto3_connection_kwargs = {'foo': 'bar', 'baz': 'blam'}
                cls.get_limits()
                cls._update_limits_from_api()
        assert mock_connect.mock_calls == [call()]
        assert mock_conn.mock_calls == [call.describe_account_limits()]
        assert mock_client.mock_calls == [
            call('elbv2', foo='bar', baz='blam'),
            call().describe_account_limits()
        ]
        assert cls.limits['Active load balancers'].api_limit == 3
        assert cls.limits['Listeners per load balancer'].api_limit == 5
        assert cls.limits['Target groups'].api_limit == 7
        assert cls.limits[
            'Listeners per application load balancer'].api_limit == 9
        assert cls.limits[
            'Rules per application load balancer'].api_limit == 10
Beispiel #2
0
    def test_update_limits_from_api(self):
        mock_conn = Mock()
        mock_conn.describe_account_limits.return_value = {
            'AccountLimits': [
                {
                    'Name': 'StackLimit',
                    'Value': 400
                },
                {
                    'Name': 'Foo',
                    'Value': 1
                }
            ],
            'ResponseMetadata': {
                'HTTPStatusCode': 200,
                'RequestId': 'cf0140c4'
            }
        }

        with patch('%s.connect' % pb) as mock_connect:
            cls = _CloudformationService(21, 43)
            cls.conn = mock_conn
            cls._update_limits_from_api()
        assert mock_connect.mock_calls == [call()]
        assert mock_conn.mock_calls == [call.describe_account_limits()]
        assert cls.limits['Stacks'].api_limit == 400
    def test_update_limits_from_api(self):
        mock_conn = Mock()
        aslimits = {
            'MaxNumberOfAutoScalingGroups': 11,
            'MaxNumberOfLaunchConfigurations': 22,
            'NumberOfAutoScalingGroups': 5,
            'NumberOfLaunchConfigurations': 6
        }

        mock_conn.describe_account_limits.return_value = aslimits
        with patch('%s.connect' % self.pb) as mock_connect:
            cls = _AutoscalingService(21, 43)
            cls.conn = mock_conn
            cls._update_limits_from_api()
        assert mock_connect.mock_calls == [call()]
        assert mock_conn.mock_calls == [call.describe_account_limits()]
        assert cls.limits['Auto Scaling groups'].api_limit == 11
        assert cls.limits['Launch configurations'].api_limit == 22
    def test_update_limits_from_api(self):
        mock_conn = Mock()
        aslimits = {
            'MaxNumberOfAutoScalingGroups': 11,
            'MaxNumberOfLaunchConfigurations': 22,
            'NumberOfAutoScalingGroups': 5,
            'NumberOfLaunchConfigurations': 6
        }

        mock_conn.describe_account_limits.return_value = aslimits
        with patch('%s.connect' % self.pb) as mock_connect:
            cls = _AutoscalingService(21, 43)
            cls.conn = mock_conn
            cls._update_limits_from_api()
        assert mock_connect.mock_calls == [call()]
        assert mock_conn.mock_calls == [
            call.describe_account_limits()
        ]
        assert cls.limits['Auto Scaling groups'].api_limit == 11
        assert cls.limits['Launch configurations'].api_limit == 22
Beispiel #5
0
    def test_update_limits_from_api(self):
        r1 = result_fixtures.ELB.test_update_limits_elb
        r2 = result_fixtures.ELB.test_update_limits_alb

        mock_conn = Mock()
        mock_conn.describe_account_limits.return_value = r1

        with patch('%s.connect' % pb) as mock_connect:
            with patch('%s.client' % pbm) as mock_client:
                m_cli = mock_client.return_value
                m_cli._client_config.region_name = PropertyMock(
                    return_value='rname'
                )
                m_cli.describe_account_limits.return_value = r2
                cls = _ElbService(21, 43)
                cls.conn = mock_conn
                cls._boto3_connection_kwargs = {'foo': 'bar', 'baz': 'blam'}
                cls.get_limits()
                cls._update_limits_from_api()
        assert mock_connect.mock_calls == [call()]
        assert mock_conn.mock_calls == [call.describe_account_limits()]
        assert mock_client.mock_calls == [
            call('elbv2', foo='bar', baz='blam'),
            call().describe_account_limits()
        ]
        assert cls.limits['Active load balancers'].api_limit == 3
        assert cls.limits['Listeners per load balancer'].api_limit == 5
        assert cls.limits[
            'Registered instances per load balancer'].api_limit == 1800
        assert cls.limits['Target groups'].api_limit == 7
        assert cls.limits[
            'Listeners per application load balancer'].api_limit == 9
        assert cls.limits['Rules per application load balancer'].api_limit == 10
        assert cls.limits[
            'Listeners per network load balancer'].api_limit == 100
        assert cls.limits['Network load balancers'].api_limit == 40