Esempio n. 1
0
 def test_restore_instance_fail(self, stdout, stderr, Request, urlopen):
     request = mock.Mock()
     Request.return_value = request
     urlopen.return_value = FakeURLopenResponse("fail", 400, "fail")
     args = ['-s', self.service_name, '-i x']
     with self.assertRaises(SystemExit):
         admin_plugin.restore_instance(args)
     stderr.write.assert_has_calls([mock.call("ERROR: fail\n")])
Esempio n. 2
0
 def test_restore_instance_fail(self, stdout, stderr, Request, urlopen):
     request = mock.Mock()
     Request.return_value = request
     urlopen.return_value = FakeURLopenResponse("fail", 400, "fail")
     args = ['-s', self.service_name, '-i x']
     with self.assertRaises(SystemExit):
         admin_plugin.restore_instance(args)
     stderr.write.assert_has_calls([mock.call("ERROR: fail\n")])
Esempio n. 3
0
 def test_restore_instance_successfully(self, stdout, Request, urlopen):
     request = mock.Mock()
     Request.return_value = request
     urlopen.return_value = FakeURLopenResponse("Restoring machine (1/1) x .....: successfully")
     args = ['-s', self.service_name, '-i x']
     admin_plugin.restore_instance(args)
     expected_output = "Restoring machine (1/1) x .....: successfully"
     call_list = []
     for char in expected_output:
         call_list.append(mock.call(char))
     stdout.write.assert_has_calls(call_list)
Esempio n. 4
0
 def test_restore_instance_successfully(self, stdout, Request, urlopen):
     request = mock.Mock()
     Request.return_value = request
     urlopen.return_value = FakeURLopenResponse("Restoring machine (1/1) x .....: successfully")
     args = ['-s', self.service_name, '-i x']
     admin_plugin.restore_instance(args)
     expected_output = "Restoring machine (1/1) x .....: successfully"
     call_list = []
     for char in expected_output:
         call_list.append(mock.call(char))
     stdout.write.assert_has_calls(call_list)