def test_capacity_successful(self, mock_ssh): c = computecapacity.ComputeCapacity({}, self.ctx) mock_ssh.SSH().execute.return_value = (0, SAMPLE_OUTPUT, '') c.run(self.result) expected_result = json.loads(SAMPLE_OUTPUT) self.assertEqual(self.result, expected_result)
def test_capacity_successful_setup(self, mock_ssh): c = computecapacity.ComputeCapacity({}, self.ctx) mock_ssh.SSH().execute.return_value = (0, '', '') c.setup() self.assertIsNotNone(c.client) self.assertTrue(c.setup_done)
def test_capacity_unsuccessful_script_error(self, mock_ssh): c = computecapacity.ComputeCapacity({}, self.ctx) mock_ssh.SSH().execute.return_value = (1, '', 'FOOBAR') self.assertRaises(RuntimeError, c.run, self.result)