def test_submit_ret_type(self): # condor_submit format: (3 lines) # Submitting job(s). # Logging submit event(s). # 1 job(s) submitted to cluster 1024. cc = CondorClient() cc._shell_submit = Mock(return_value=('', '', '1 job(s) submitted to cluster 1024.')) self.assertEqual(cc.submit('file'), ('1', '1024'))
class CondorClientTest(unittest.TestCase): """ Test the CondorClient class. """ def setUp(self): self.c = CondorClient() def test_submit_param_file(self): self.assertRaises(TypeError, self.c.submit, 1) def test_submit_param_shell(self): self.assertRaises(TypeError, self.c.submit, 'toto', 1) def test_submit_bad_file(self): self.assertRaises(CondorSubmitError, self.c.submit, 'unknown') def test_submit_shell_call(self): cc = CondorClient() cc._shell_submit = Mock(return_value=('', '', '1 job, cluster 1024.')) cc.submit('file') self.assertTrue(cc._shell_submit.called, 'shell_submit() not called') def test_submit_ret_type(self): # condor_submit format: (3 lines) # Submitting job(s). # Logging submit event(s). # 1 job(s) submitted to cluster 1024. cc = CondorClient() cc._shell_submit = Mock(return_value=('', '', '1 job(s) submitted to cluster 1024.')) self.assertEqual(cc.submit('file'), ('1', '1024')) def test_getStatus_ret_type(self): stat = self.c.getStatus() self.assertTrue(type(stat) == types.ListType) def test_getStatus_ret_type_unit(self): stat = self.c.getStatus() for vm in stat: self.assertTrue(len(vm) == 2) self.assertTrue(type(vm[0]) == types.StringType) self.assertTrue(type(vm[1]) == types.StringType)
def test_submit_shell_call(self): cc = CondorClient() cc._shell_submit = Mock(return_value=('', '', '1 job, cluster 1024.')) cc.submit('file') self.assertTrue(cc._shell_submit.called, 'shell_submit() not called')
def setUp(self): self.c = CondorClient()