def test_get_spot_requests(m):
    r1 = mock.Mock()
    r1.launch_specification.instance_type = "t1"
    r1.launched_availability_zone = "az1"
    r2 = mock.Mock()
    r2.launch_specification.instance_type = "t2"
    r2.launched_availability_zone = "az1"
    r3 = mock.Mock()
    r3.launch_specification.instance_type = "t1"
    r3.launched_availability_zone = "az2"
    m.return_value = [r1, r2, r3]
    assert get_spot_requests("r1", "t1", "az1") == [r1]
    m.assert_called_once_with("r1")
def test_get_spot_requests(m):
    r1 = mock.Mock()
    r1.launch_specification.instance_type = "t1"
    r1.launched_availability_zone = "az1"
    r2 = mock.Mock()
    r2.launch_specification.instance_type = "t2"
    r2.launched_availability_zone = "az1"
    r3 = mock.Mock()
    r3.launch_specification.instance_type = "t1"
    r3.launched_availability_zone = "az2"
    m.return_value = [r1, r2, r3]
    assert get_spot_requests("r1", "t1", "az1") == [r1]
    m.assert_called_once_with("r1")
def test_no_requests(m):
    m.return_value = None
    # Warning: make sure to specify different values to avoid LRU caching
    assert get_spot_requests("R1", "T1", "AZ1") == []
def test_no_requests(m):
    m.return_value = None
    # Warning: make sure to specify different values to avoid LRU caching
    assert get_spot_requests("R1", "T1", "AZ1") == []