def test_GetJobThrowsErrorOnMissingJobId(self): m = Manifest( self.writeTestJsonFile({ "ProjectName": "testProject", "BucketName": "bucket", "Documents": [ { "Name": "document", "Direction": "LocalToAWS", "LocalPath": "mylocalPath", "AWSInstancePath": "awsinstancepath" }, ], "InstanceJobs": [{ "Id": 1, "RequiredS3Data": ["document"], "Commands": [{ "Command": "run.exe", "Args": [] }] }, { "Id": 2, "RequiredS3Data": ["document"], "Commands": [{ "Command": "run.exe", "Args": [] }] }, { "Id": 3, "RequiredS3Data": ["document"], "Commands": [{ "Command": "run.exe", "Args": [] }] }] })) self.assertRaises(ValueError, lambda: m.GetJob(999))
def test_GetJobReturnsExpectedValues(self): m = Manifest( self.writeTestJsonFile({ "ProjectName": "testProject", "BucketName": "bucket", "Documents": [ { "Name": "document1", "Direction": "Static", "LocalPath": ".", "AWSInstancePath": "awsinstancepath" }, { "Name": "document2", "Direction": "LocalToAWS", "LocalPath": ".", "AWSInstancePath": "awsinstancepath" }, ], "InstanceJobs": [{ "Id": 1, "RequiredS3Data": ["document1"], "Commands": [{ "Command": "run.exe", "Args": [1, 2, 3] }] }, { "Id": 2, "RequiredS3Data": ["document1"], "Commands": [{ "Command": "run2.exe", "Args": [3, 2, 1] }] }, { "Id": 3, "RequiredS3Data": ["document1", "document2"], "Commands": [{ "Command": "run3.exe", "Args": [1] }, { "Command": "run4.exe", "Args": ["a", "b"] }] }] })) j1 = m.GetJob(1) self.assertEqual(j1["Id"], 1) self.assertEqual(j1["RequiredS3Data"], ["document1"]) self.assertEqual(j1["Commands"], [{ "Command": "run.exe", "Args": [1, 2, 3] }]) j2 = m.GetJob(2) self.assertEqual(j2["Id"], 2) self.assertEqual(j2["RequiredS3Data"], ["document1"]) self.assertEqual(j2["Commands"], [{ "Command": "run2.exe", "Args": [3, 2, 1] }]) j3 = m.GetJob(3) self.assertEqual(j3["Id"], 3) self.assertEqual(j3["RequiredS3Data"], ["document1", "document2"]) self.assertEqual(j3["Commands"], [{ "Command": "run3.exe", "Args": [1] }, { "Command": "run4.exe", "Args": ["a", "b"] }])