示例#1
0
    def test_import_project(self):
        sg_project = {
            "id": 3,
            "name": "Elephant Dream",
            "sg_status": "Active",
            "sg_fps": "25",
            "sg_width___height": "1920 / 1080",
            "type": "Project",
        }

        api_path = "/import/shotgun/projects"
        self.projects = self.post(api_path, [sg_project], 200)
        self.assertEqual(len(self.projects), 1)

        self.projects = self.get("data/projects")
        self.assertEqual(len(self.projects), 1)

        project = self.projects[0]
        project_status = ProjectStatus.get_by(name=sg_project["sg_status"])
        self.assertEqual(project["name"], sg_project["name"])
        self.assertEqual(project["shotgun_id"], sg_project["id"])
        self.assertEqual(project["project_status_id"], str(project_status.id))
        self.assertEqual(project["data"]["sg_fps"], sg_project["sg_fps"])
        self.assertEqual(
            project["data"]["sg_width___height"],
            sg_project["sg_width___height"],
        )
示例#2
0
def get_or_create_status(name):
    """
    Return given status. If it does not exist, it creates it.
    """
    project_status = ProjectStatus.get_by(name=name)
    if project_status is None:
        project_status = ProjectStatus(name=name, color="#000000")
        project_status.save()
    return project_status.serialize()
示例#3
0
def get_or_create_status(name):
    project_status = ProjectStatus.get_by(name=name)
    if project_status is None:
        project_status = ProjectStatus(
            name=name,
            color="#000000"
        )
        project_status.save()
    return project_status