示例#1
0
    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
示例#2
0
  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
示例#3
0
    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
示例#4
0
  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