def test_no_server(self): with mock.patch('cloudenvy.template.Template') as m: instance = m.return_value instance.find_server.return_value = False main.destroy(self.args) assert not instance.delete_server.called assert instance.find_server.call_count == 1
def test_basic(self): with mock.patch('cloudenvy.template.Template') as m: instance = m.return_value instance.find_server.side_effect = [True] * 5 + [False] instance.delete_server.return_value = None main.destroy(self.args) assert instance.delete_server.called assert instance.find_server.call_count == 6