c_foo = c.exclude('foo', lambda role: role.startswith('b'))
assert c_foo.remotes == {r2: ['bar'], r3: ['foo']}
- @fudge.with_fakes
@patch("teuthology.misc.write_file")
@patch("teuthology.misc.sudo_write_file")
def test_write_file(self, m_sudo_write_file, m_write_file):
- fudge.clear_expectations()
r1 = remote.Remote('r1', ssh=fudge.Fake('SSH'))
c = cluster.Cluster(
remotes=[
],
)
c.write_file("filename", "content", sudo=True)
- assert m_sudo_write_file.called
m_sudo_write_file.assert_called_with(r1, "filename", "content", owner=None, perms=None)
with pytest.raises(ValueError):
c.write_file("filename", "content", sudo=False, perms="perms")
c.write_file("filename", "content")
- assert m_write_file.called
m_write_file.assert_called_with(r1, "filename", "content")