コード例 #1
0
 def test_all_task_types_for_scene(self):
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "GET",
             "data/scenes/scene-01/task-types",
             text=[{
                 "name": "scene1",
                 "id": "scene-01"
             }],
         )
         scene = {"id": "scene-01"}
         self.assertEqual(
             gazu.context.all_task_types_for_scene(scene, False),
             gazu.task.all_task_types_for_scene(scene),
         )
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "GET",
             "data/user/scenes/scene-01/task-types",
             text=[{
                 "name": "scene1",
                 "id": "scene-01"
             }],
         )
         scene = {"id": "scene-01"}
         self.assertEqual(
             gazu.context.all_task_types_for_scene(scene, True),
             gazu.user.all_task_types_for_scene(scene),
         )
コード例 #2
0
    def test_all_task_types_for_sequence(self):
        with requests_mock.mock() as mock:
            mock_route(
                mock,
                "GET",
                "data/sequences/sequence-01/task-types",
                text=[{
                    "id": "task-type-01",
                    "name": "Modeling"
                }],
            )

            sequence = {"id": "sequence-01"}
            self.assertEqual(
                gazu.context.all_task_types_for_sequence(sequence, False),
                gazu.task.all_task_types_for_sequence(sequence),
            )
        with requests_mock.mock() as mock:
            mock_route(
                mock,
                "GET",
                "data/user/sequences/sequence-1/task-types",
                text=[{
                    "name": "previz",
                    "id": "task-type-01"
                }],
            )

            sequence = {"id": "sequence-1"}
            self.assertEqual(
                gazu.context.all_task_types_for_sequence(sequence, True),
                gazu.user.all_task_types_for_sequence(sequence),
            )
コード例 #3
0
 def test_all_task_types_for_asset(self):
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "GET",
             "data/assets/asset-01/task-types",
             text=[{
                 "name": "Modeling"
             }],
         )
         asset = {"id": "asset-01"}
         self.assertEqual(
             gazu.context.all_task_types_for_asset(asset, False),
             gazu.task.all_task_types_for_asset(asset),
         )
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "GET",
             "data/user/assets/asset-01/task-types",
             text=[{
                 "name": "modeling",
                 "id": "task-type-01"
             }],
         )
         asset = {"id": "asset-01"}
         self.assertEqual(
             gazu.context.all_task_types_for_asset(asset, True),
             gazu.user.all_task_types_for_asset(asset),
         )
コード例 #4
0
 def test_all_episodes_for_project(self):
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "GET",
             "data/projects/project-01/episodes",
             text=[{
                 "name": "Episode 01",
                 "project_id": "project-01"
             }],
         )
         project = {"id": "project-01"}
         self.assertEqual(
             gazu.context.all_episodes_for_project(project, False),
             gazu.shot.all_episodes_for_project(project),
         )
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "GET",
             "data/user/projects/project-01/episodes",
             text=[{
                 "name": "Episode 01",
                 "project_id": "project-01"
             }],
         )
         project = {"id": "project-01"}
         self.assertEqual(
             gazu.context.all_episodes_for_project(project, True),
             gazu.user.all_episodes_for_project(project),
         )
コード例 #5
0
    def test_all_task_types_for_shot(self):
        with requests_mock.mock() as mock:
            mock_route(
                mock,
                "GET",
                "data/shots/shot-01/task-types",
                text=[{
                    "id": "task-type-01",
                    "name": "Modeling"
                }],
            )

            shot = {"id": "shot-01"}
            self.assertEqual(
                gazu.context.all_task_types_for_shot(shot, False),
                gazu.task.all_task_types_for_shot(shot),
            )
        with requests_mock.mock() as mock:
            mock_route(
                mock,
                "GET",
                "data/user/shots/shot-01/task-types",
                text=[{
                    "name": "animation",
                    "id": "task-type-01"
                }],
            )

            shot = {"id": "shot-01"}
            self.assertEqual(
                gazu.context.all_task_types_for_shot(shot, True),
                gazu.user.all_task_types_for_shot(shot),
            )
コード例 #6
0
 def test_all_open_projects(self):
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "GET",
             "data/projects/open",
             text=[{
                 "name": "Agent 327",
                 "id": "project-01"
             }],
         )
         self.assertEqual(
             gazu.context.all_open_projects(False),
             gazu.project.all_open_projects(),
         )
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "GET",
             "data/user/projects/open",
             text=[{
                 "name": "Big Buck Bunny",
                 "id": "project-01"
             }],
         )
         self.assertEqual(
             gazu.context.all_open_projects(True),
             gazu.user.all_open_projects(),
         )
コード例 #7
0
 def test_all_shots_for_sequence(self):
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "GET",
             "data/sequences/sequence-01/shots",
             text=[{
                 "name": "Shot 01",
                 "project_id": "project-01",
                 "parent_id": "sequence-01",
             }],
         )
         sequence = {"id": "sequence-01"}
         self.assertEqual(
             gazu.context.all_shots_for_sequence(sequence, False),
             gazu.shot.all_shots_for_sequence(sequence),
         )
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "GET",
             "data/user/sequences/sequence-01/shots",
             text=[{
                 "name": "Shot 01",
                 "project_id": "project-01",
                 "parent_id": "sequence-01",
             }],
         )
         sequence = {"id": "sequence-01"}
         self.assertEqual(
             gazu.context.all_shots_for_sequence(sequence, True),
             gazu.user.all_shots_for_sequence(sequence),
         )
コード例 #8
0
    def test_add_asset_type(self):
        with requests_mock.mock() as mock:
            mock_route(
                mock,
                "POST",
                "data/projects/%s/settings/asset-types" % fakeid("project-1"),
                text={
                    "name": "asset-types-1",
                    "id": fakeid("asset-types-1"),
                },
            )
            asset_type = gazu.project.add_asset_type(
                fakeid("project-1"),
                {
                    "name": "asset-types-1",
                    "id": fakeid("asset-types-1"),
                },
            )

            self.assertEqual(
                asset_type,
                {
                    "name": "asset-types-1",
                    "id": fakeid("asset-types-1"),
                },
            )
コード例 #9
0
    def test_add_task_type(self):
        with requests_mock.mock() as mock:
            mock_route(
                mock,
                "POST",
                "data/projects/%s/settings/task-types" % fakeid("project-1"),
                text={
                    "name": "task-types-1",
                    "id": fakeid("task-types-1"),
                    "priority": None,
                },
            )
            task_types = gazu.project.add_task_type(
                fakeid("project-1"),
                {
                    "name": "task-types-1",
                    "id": fakeid("task-types-1"),
                },
                priority=None,
            )

            self.assertEqual(
                task_types,
                {
                    "name": "task-types-1",
                    "id": fakeid("task-types-1"),
                    "priority": None,
                },
            )
コード例 #10
0
    def test_add_task_status(self):
        with requests_mock.mock() as mock:
            mock_route(
                mock,
                "POST",
                "data/projects/%s/settings/task-status" % fakeid("project-1"),
                text={
                    "name": "task-status-1",
                    "id": fakeid("task-status-1"),
                },
            )
            task_status = gazu.project.add_task_status(
                fakeid("project-1"),
                {
                    "name": "task-status-1",
                    "id": fakeid("task-status-1"),
                },
            )

            self.assertEqual(
                task_status,
                {
                    "name": "task-status-1",
                    "id": fakeid("task-status-1"),
                },
            )
コード例 #11
0
    def test_all_asset_types_for_project(self):
        with requests_mock.mock() as mock:
            mock_route(
                mock,
                "GET",
                "data/projects/project-01/asset-types",
                text=[{
                    "name": "Asset Type 01"
                }],
            )
            project = {"id": "project-01"}
            self.assertEqual(
                gazu.context.all_asset_types_for_project(project, False),
                gazu.asset.all_asset_types_for_project(project),
            )
        with requests_mock.mock() as mock:
            mock_route(
                mock,
                "GET",
                "data/user/projects/project-01/asset-types",
                text=[{
                    "name": "Props",
                    "id": "asset-type-01"
                }],
            )

            project = {"id": "project-01"}
            self.assertEqual(
                gazu.context.all_asset_types_for_project(project, True),
                gazu.user.all_asset_types_for_project(project),
            )
コード例 #12
0
    def test_add_attachment_files_to_comment(self):
        with open("./tests/fixtures/v1.png", "rb") as test_file:
            with requests_mock.Mocker() as mock:
                text = {"id": fakeid("attachment-1")}
                mock_route(
                    mock,
                    "POST",
                    "actions/tasks/%s/comments/%s/add-attachment" %
                    (fakeid("task-1"), fakeid("comment-1")),
                    text=text,
                )

                add_verify_file_callback(
                    mock,
                    {"file": test_file.read()},
                    "actions/tasks/%s/comments/%s/add-attachment" %
                    (fakeid("task-1"), fakeid("comment-1")),
                )

                self.assertEqual(
                    gazu.task.add_attachment_files_to_comment(
                        fakeid("task-1"),
                        fakeid("comment-1"),
                        "./tests/fixtures/v1.png",
                    ),
                    text,
                )

            with self.assertRaises(ValueError):
                gazu.task.add_attachment_files_to_comment(
                    fakeid("task-1"), fakeid("comment-1"))
コード例 #13
0
ファイル: test_client.py プロジェクト: cgwire/gazu
    def test_upload(self):
        with open("./tests/fixtures/v1.png", "rb") as test_file:
            with requests_mock.Mocker() as mock:
                mock_route(
                    mock,
                    "POST",
                    "data/new-file",
                    text={"id": "person-01", "first_name": "John"},
                )

                add_verify_file_callback(
                    mock, {"file": test_file.read(), "test": "True"}
                )

                raw.upload(
                    "data/new-file",
                    "./tests/fixtures/v1.png",
                    data={"test": True},
                )
            with requests_mock.Mocker() as mock:
                mock_route(
                    mock,
                    "POST",
                    "data/new-file",
                    text={"message": "Error"},
                )
                with self.assertRaises(gazu.client.UploadFailedException):
                    raw.upload(
                        "data/new-file",
                        "./tests/fixtures/v1.png",
                        data={"test": True},
                    )
コード例 #14
0
    def test_add_preview(self):
        with open("./tests/fixtures/v1.png", "rb") as test_file:
            with requests_mock.Mocker() as mock:
                mock_route(
                    mock,
                    "POST",
                    "actions/tasks/%s/comments/%s/add-preview" % (
                        fakeid("task-1"),
                        fakeid("comment-1"),
                    ),
                    text={"id": fakeid("preview-1")},
                )
                mock_route(
                    mock,
                    "POST",
                    "pictures/preview-files/%s" % fakeid("preview-1"),
                    text={"id": fakeid("preview-1")},
                )

                add_verify_file_callback(
                    mock,
                    {"file": test_file.read()},
                    "pictures/preview-files/%s" % fakeid("preview-1"),
                )

                self.assertEqual(
                    gazu.task.add_preview(
                        fakeid("task-1"),
                        fakeid("comment-1"),
                        "./tests/fixtures/v1.png",
                    ),
                    {"id": fakeid("preview-1")},
                )
コード例 #15
0
ファイル: test_asset.py プロジェクト: cgwire/gazu
 def test_all_assets_for_project(self):
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "GET",
             "data/projects/project-01/assets",
             text=[{"name": "Asset 01", "project_id": "project-01"}],
         )
         project = {"id": "project-01"}
         assets = gazu.asset.all_assets_for_project(project)
         self.assertEqual(len(assets), 1)
         asset = assets[0]
         self.assertEqual(asset["name"], "Asset 01")
         self.assertEqual(asset["project_id"], "project-01")
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "GET",
             "data/assets/all",
             text=[{"name": "Asset 01", "project_id": "project-01"}],
         )
         assets = gazu.asset.all_assets_for_project(None)
         self.assertEqual(len(assets), 1)
         asset = assets[0]
         self.assertEqual(asset["name"], "Asset 01")
         self.assertEqual(asset["project_id"], "project-01")
コード例 #16
0
ファイル: test_client.py プロジェクト: cgwire/gazu
    def test_upload_multiple_files(self):
        with open("./tests/fixtures/v1.png", "rb") as test_file:
            with requests_mock.Mocker() as mock:
                mock_route(
                    mock,
                    "POST",
                    "data/new-file",
                    text={"id": "person-01", "first_name": "John"},
                )
                test_file_read = test_file.read()
                add_verify_file_callback(
                    mock,
                    {
                        "file": test_file_read,
                        "file-2": test_file_read,
                        "test": "True",
                    },
                )

                raw.upload(
                    "data/new-file",
                    "./tests/fixtures/v1.png",
                    data={
                        "test": True,
                    },
                    extra_files=["./tests/fixtures/v1.png"],
                )
コード例 #17
0
 def test_all_scenes(self):
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "GET",
             "data/projects/project-01/scenes",
             text=[{
                 "name": "Scene 01",
                 "project_id": "project-01"
             }],
         )
         mock_route(
             mock,
             "GET",
             "data/scenes",
             text=[{
                 "name": "Scene 01",
                 "project_id": "project-01"
             }],
         )
         project = {"id": "project-01"}
         scenes = gazu.scene.all_scenes_for_project(project)
         self.assertEqual(len(scenes), 1)
         scene_instance = scenes[0]
         self.assertEqual(scene_instance["name"], "Scene 01")
         self.assertEqual(scene_instance["project_id"], "project-01")
         scenes = gazu.scene.all_scenes()
         self.assertEqual(len(scenes), 1)
         scene_instance = scenes[0]
         self.assertEqual(scene_instance["name"], "Scene 01")
         self.assertEqual(scene_instance["project_id"], "project-01")
コード例 #18
0
 def test_restore_shot(self):
     with requests_mock.mock() as mock:
         text = {"id": fakeid("shot-1"), "canceled": False}
         mock_route(mock,
                    "PUT",
                    "data/shots/%s" % fakeid("shot-1"),
                    text=text)
         self.assertEqual(gazu.shot.restore_shot(fakeid("shot-1")), text)
コード例 #19
0
 def test_remove_task_type(self):
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "DELETE",
             "data/task-types/%s?force=true" % fakeid("task-type-1"),
             status_code=204,
         )
         gazu.task.remove_task_type(fakeid("task-type-1"))
コード例 #20
0
ファイル: test_files.py プロジェクト: cgwire/gazu
 def test_get_output_file_by_path(self):
     with requests_mock.mock() as mock:
         text = [{"id": fakeid("output-file-1"), "path": "testpath"}]
         mock_route(
             mock, "GET", "/data/output-files?path=testpath", text=text
         )
         self.assertEqual(
             gazu.files.get_output_file_by_path("testpath"), text[0]
         )
コード例 #21
0
 def test_remove_comment(self):
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "DELETE",
             "data/comments/%s" % fakeid("comment-1"),
             status_code=204,
             text="",
         )
         gazu.task.remove_comment(fakeid("comment-1"))
コード例 #22
0
 def test_get_episode(self):
     with requests_mock.mock() as mock:
         result = {"name": "Episode 01", "project_id": "project-01"}
         mock_route(
             mock,
             "GET",
             "data/episodes/%s" % (fakeid("episode-1")),
             text=result,
         )
         self.assertEqual(gazu.shot.get_episode(fakeid("episode-1")),
                          result)
コード例 #23
0
ファイル: test_project.py プロジェクト: frankrousseau/gazu
 def test_all_open_projects(self):
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "GET",
             "data/projects/open",
             text=[{"name": "Agent 327", "id": "project-01"}],
         )
         projects = gazu.project.all_open_projects()
         project_instance = projects[0]
         self.assertEqual(project_instance["name"], "Agent 327")
コード例 #24
0
ファイル: test_asset.py プロジェクト: cgwire/gazu
 def test_all_asset_types_for_project(self):
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "GET",
             "data/projects/project-01/asset-types",
             text=[{"name": "Asset Type 01"}],
         )
         project = {"id": "project-01"}
         asset_types = gazu.asset.all_asset_types_for_project(project)
         asset_type = asset_types[0]
         self.assertEqual(asset_type["name"], "Asset Type 01")
コード例 #25
0
 def test_get_comment(self):
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "GET",
             "data/comments/%s" % fakeid("comment-1"),
             text={"id": fakeid("comment-1")},
         )
         self.assertEqual(
             gazu.task.get_comment(fakeid("comment-1"))["id"],
             fakeid("comment-1"),
         )
コード例 #26
0
ファイル: test_asset.py プロジェクト: cgwire/gazu
 def test_get_asset_type(self):
     with requests_mock.mock() as mock:
         result = {"name": "Asset Type 01", "id": fakeid("asset-type-1")}
         mock_route(
             mock,
             "GET",
             "data/asset-types/%s" % fakeid("asset-type-1"),
             text=result,
         )
         self.assertEqual(
             gazu.asset.get_asset_type(fakeid("asset-type-1")), result
         )
コード例 #27
0
ファイル: test_task.py プロジェクト: frankrousseau/gazu
 def test_all_task_types_for_scene(self):
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "GET",
             "data/scenes/scene-01/task-types",
             text=[{"name": "scene1", "id": "scene-01"}],
         )
         scene = {"id": "scene-01"}
         tasks = gazu.context.all_task_types_for_scene(scene, False)
         task = tasks[0]
         self.assertEqual(task["name"], "scene1")
コード例 #28
0
ファイル: test_task.py プロジェクト: frankrousseau/gazu
 def test_all_task_types_for_asset(self):
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "GET",
             "data/assets/asset-01/task-types",
             text=[{"name": "Modeling"}],
         )
         asset = {"id": "asset-01"}
         asset_types = gazu.task.all_task_types_for_asset(asset)
         asset_instance = asset_types[0]
         self.assertEqual(asset_instance["name"], "Modeling")
コード例 #29
0
 def test_get_task_status_by_short_name(self):
     with requests_mock.mock() as mock:
         mock_route(
             mock,
             "GET",
             "data/task-status?short_name=task_status_shortname",
             text=[{
                 "id": fakeid("task-status-1")
             }],
         )
         task_status = gazu.task.get_task_status_by_short_name(
             "task_status_shortname")
         self.assertEqual(task_status["id"], fakeid("task-status-1"))
コード例 #30
0
ファイル: test_task.py プロジェクト: frankrousseau/gazu
    def test_all_task_types_for_shot(self):
        with requests_mock.mock() as mock:
            mock_route(
                mock,
                "GET",
                "data/shots/shot-01/task-types",
                text=[{"id": "task-type-01", "name": "Modeling"}],
            )

            shot = {"id": "shot-01"}
            task_types = gazu.task.all_task_types_for_shot(shot)
            task_type = task_types[0]
            self.assertEqual(task_type["name"], "Modeling")