diff --git a/tests/fixtures/test.csv b/tests/fixtures/test.csv new file mode 100644 index 00000000..07369a20 --- /dev/null +++ b/tests/fixtures/test.csv @@ -0,0 +1 @@ +;;;;; diff --git a/tests/fixtures/test.edl b/tests/fixtures/test.edl new file mode 100644 index 00000000..645256b5 --- /dev/null +++ b/tests/fixtures/test.edl @@ -0,0 +1,5 @@ +TITLE: Timeline 1 +FCM: NON-DROP FRAME + +001 AX V C 00:00:00:00 00:00:05:00 01:00:00:00 01:00:05:00 +* FROM CLIP NAME: TEST_E001-SEQ001_0001.mov diff --git a/tests/test_shot.py b/tests/test_shot.py index 4afc03d1..606b8439 100644 --- a/tests/test_shot.py +++ b/tests/test_shot.py @@ -6,7 +6,7 @@ import gazu.client import gazu.shot -from utils import fakeid, mock_route +from utils import fakeid, mock_route, add_verify_file_callback class ShotTestCase(unittest.TestCase): @@ -692,3 +692,75 @@ def test_exports_shots_with_csv(self): with open("./test.csv", "r") as export_csv: self.assertEqual(csv, export_csv.read()) os.remove("./test.csv") + + def test_import_otio(self): + with open("./tests/fixtures/test.edl", "rb") as test_file: + with requests_mock.Mocker() as mock: + mock_route( + mock, + "POST", + "/import/otio/projects/%s" % fakeid("project-1"), + text={"success": True}, + ) + + add_verify_file_callback( + mock, + {"file": test_file.read()}, + "/import/otio/projects/%s" % fakeid("project-1"), + ) + + self.assertEqual( + gazu.shot.import_otio( + fakeid("project-1"), "./tests/fixtures/test.edl" + ), + {"success": True}, + ) + + with open("./tests/fixtures/test.edl", "rb") as test_file: + with requests_mock.Mocker() as mock: + mock_route( + mock, + "POST", + "/import/otio/projects/%s/episodes/%s" + % (fakeid("project-1"), fakeid("episode-1")), + text={"success": True}, + ) + + add_verify_file_callback( + mock, + {"file": test_file.read()}, + "/import/otio/projects/%s/episodes/%s" + % (fakeid("project-1"), fakeid("episode-1")), + ) + + self.assertEqual( + gazu.shot.import_otio( + fakeid("project-1"), + "./tests/fixtures/test.edl", + episode=fakeid("episode-1"), + ), + {"success": True}, + ) + + def test_import_shots_with_csv(self): + with open("./tests/fixtures/test.csv", "rb") as test_file: + with requests_mock.Mocker() as mock: + mock_route( + mock, + "POST", + "import/csv/projects/%s/shots" % fakeid("project-1"), + text={"success": True}, + ) + + add_verify_file_callback( + mock, + {"file": test_file.read()}, + "import/csv/projects/%s/shots" % fakeid("project-1"), + ) + + self.assertEqual( + gazu.shot.import_shots_with_csv( + fakeid("project-1"), "./tests/fixtures/test.csv" + ), + {"success": True}, + )