Esempio n. 1
0
def test_can_get_mock_calls():
    mock = Mock(name="test_class.prop1")
    PyMock.mock(mock, return_values=[1])
    mock(4)
    mock(5)
    calls = PyMock.calls(mock)
    assert calls[0]['args'][0] == 4
    assert calls[1]['args'][0] == 5
Esempio n. 2
0
def find_write_template_calls(fs: MockFileSystem,
                              cluster: str = None) -> List[dict]:
    calls = PyMock.calls(fs.file_system.write)
    matches = []
    for call in calls:
        if cluster is not None and call['args'][
                0] == '/var/app-root/output/' + cluster + '/k8s.yaml':
            matches = matches + load_all(call['args'][1])
        if call['args'][0] == '/temp/template.yaml':
            matches = matches + load_all(call['args'][1])
        if call['args'][0] == '/var/app-root/output/k8s.yaml':
            matches = matches + load_all(call['args'][1])
    if len(matches) > 0:
        return matches
    raise Exception('fs.write not used to write template')