def test__init__raise_called_with_command(self): command = "a string" sut = MasterNodeInterface(command) self.assertTrue(sut._command == command, "The constructor did not assign the command to the local variabale") self.assertTrue(hasattr(sut, '_jobs') and isinstance(sut._jobs, list), "The constructor did create a list data member called _list")
def test_append_job(self): command = "a string" sut = MasterNodeInterface(command) sut.append_job("test", ["arg1", "arg2"]) self.assertTrue(len(sut._jobs) == 1 , "append_job did not add a job" " To the job list") self.assertTrue(isinstance(sut._jobs[0], ComputeJob) , "append_job did not add an object with the type ComputeJob to" " the job list")
def test_on_succes_raise_exception(self): command = "a string" sut = MasterNodeInterface(command) # on_error by default returns 0, check return value. self.assertEqual(0, sut.on_succes())
def test_on_error_return_value(self): command = "a string" sut = MasterNodeInterface(command) # on_error by default returns 0, check return value. self.assertEqual(1, sut.on_error())
def test_on_failure_return_value(self): command = "a string" sut = MasterNodeInterface(command) # on_failure by default returns 1, check return value. self.assertEqual(-1, sut.on_failure())