Skip to content

Commit

Permalink
[qa] add tests for gazu.shot.import_otio / gazu.shot.import_shots_wit…
Browse files Browse the repository at this point in the history
…h_csv
  • Loading branch information
EvanBldy committed Mar 26, 2024
1 parent c17cd0d commit 4d13213
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/fixtures/test.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
;;;;;
5 changes: 5 additions & 0 deletions tests/fixtures/test.edl
Original file line number Diff line number Diff line change
@@ -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
74 changes: 73 additions & 1 deletion tests/test_shot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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},
)

0 comments on commit 4d13213

Please sign in to comment.