예제 #1
0
    def test_no_reservations(self, connect_to_region):

        reservations = []
        connection = (fudge.Fake('connection')
                      .expects('get_all_instances')
                      .returns(reservations))
        connect_to_region.expects_call().with_args(caiman.REGION).returns(connection)
        instances = list(caiman.get_running_instances('n/a'))
        assert instances == []
예제 #2
0
    def test_with_reservations(self, connect_to_region):

        instances = [100, 200, 300]
        reservations = [fudge.Fake('reservation').has_attr(instances=instances)]
        connection = (fudge.Fake('connection')
                      .expects('get_all_instances')
                      .returns(reservations))
        connect_to_region.expects_call().with_args(caiman.REGION).returns(connection)
        instances = list(caiman.get_running_instances('n/a'))
        assert instances == [100, 200, 300]