Exemplo n.º 1
0
    def test_get_reserved_instance_count(self):
        response = fixtures.test_get_reserved_instance_count

        cls = _Ec2Service(21, 43)
        mock_client_conn = Mock()
        cls.conn = mock_client_conn
        mock_client_conn.describe_reserved_instances.return_value = response
        mock_conn = Mock()
        cls.resource_conn = mock_conn

        res = cls._get_reserved_instance_count()
        assert res == {
            'az1': {
                'it1': 10,
            },
            'az2': {
                'it2': 98,
            },
            RI_NO_AZ: {
                'it2': 9,
                'it3': 6
            }
        }
        assert mock_conn.mock_calls == []
        assert mock_client_conn.mock_calls == [
            call.describe_reserved_instances()
        ]
Exemplo n.º 2
0
    def test_get_reserved_instance_count(self):
        response = fixtures.test_get_reserved_instance_count

        cls = _Ec2Service(21, 43)
        mock_client_conn = Mock()
        cls.conn = mock_client_conn
        mock_client_conn.describe_reserved_instances.return_value = response
        mock_conn = Mock()
        cls.resource_conn = mock_conn

        res = cls._get_reserved_instance_count()
        assert res == {
            'az1': {
                'it1': 10,
            },
            'az2': {
                'it2': 98,
            },
            RI_NO_AZ: {
                'it2': 9,
                'it3': 6
            }
        }
        assert mock_conn.mock_calls == []
        assert mock_client_conn.mock_calls == [
            call.describe_reserved_instances()
        ]