Esempio n. 1
0
def test_rollback_nowhere_to_go(get_current, set_current):
    get_current.return_value = 'aaa'
    with mock_history(initial=['aaa']) as releases:
        with pytest.raises(RuntimeError):
            rollback()
        assert releases == ['aaa']
    assert_has_calls(set_current, [])
Esempio n. 2
0
def test_rollback_nowhere_to_go(get_current, set_current):
    get_current.return_value = 'aaa'
    with mock_history(initial=['aaa']) as releases:
        with pytest.raises(RuntimeError):
            rollback()
        assert releases == ['aaa']
    assert_has_calls(set_current, [])
Esempio n. 3
0
def test_print_config(local_state, global_state, print_):
    local_state.get.return_value = 'bar'
    data = ['foo', None]
    global_state.get = lambda x: data.pop(0)
    print_config()
    calls = [
        call('cloud: foo'),
        call('region: None'),
        call('project: bar'),
    ]
    assert_has_calls(print_, calls)
Esempio n. 4
0
def test_print_config(local_state, global_state, print_):
    local_state.get.return_value = 'bar'
    data = ['foo', None]
    global_state.get = lambda x: data.pop(0)
    print_config()
    calls = [
        call('cloud: foo'),
        call('region: None'),
        call('project: bar'),
    ]
    assert_has_calls(print_, calls)
Esempio n. 5
0
    def test_set(self, config_proxy, global_state):
        config_proxy.CLOUD = {
            'REGIONS': ['region1', 'region2'],
        }
        state = {
            'cloud': 'foo',
        }
        global_state.__getitem__ = state.__getitem__
        set_cloud('foo')

        calls = [
            call('cloud', 'foo'),
            call('region', 'region1'),
        ]
        assert_has_calls(global_state.__setitem__, calls)
Esempio n. 6
0
    def test_set(self, config_proxy, global_state):
        config_proxy.get_cloud.return_value = {
            'REGIONS': ['region1', 'region2'],
        }
        state = {
            'cloud': 'foo',
        }

        global_state.__getitem__ = state.__getitem__

        set_cloud('foo')

        calls = [
            call('cloud', 'foo'),
            call('region', 'region1'),
        ]
        assert_has_calls(global_state.__setitem__, calls)