Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SG-35018 Remove Ticket entity reference and prepare this to run in CI #349

Merged

Add Jenkins setting

a2ca6e5
Select commit
Loading
Failed to load commit list.
Merged

SG-35018 Remove Ticket entity reference and prepare this to run in CI #349

Add Jenkins setting
a2ca6e5
Select commit
Loading
Failed to load commit list.
Azure Pipelines / shotgunsoftware.python-api succeeded Jun 19, 2024 in 11m 8s

Build #20240619.3 had test failures

Details

Tests

  • Failed: 2 (0.07%)
  • Passed: 2,868 (99.93%)
  • Other: 0 (0.00%)
  • Total: 2,870
Code coverage

  • 2706 of 5025 lines covered (53.85%)

Annotations

Check failure on line 1 in tests/test_api.py::TestReadAdditionalFilterPresets::test_modify_visibility

See this annotation in the file changed.

@azure-pipelines azure-pipelines / shotgunsoftware.python-api

tests/test_api.py::TestReadAdditionalFilterPresets::test_modify_visibility

self = <tests.test_api.TestReadAdditionalFilterPresets testMethod=test_modify_visibility>

    def test_modify_visibility(self):
        """
        Ensure the visibility of a field can be edited via the API.
        """
        # If the version of Shotgun is too old, do not run this test.
        # TODO: Update this with the real version number once the feature is released.
        if self.sg_version < (8, 5, 0):
            warnings.warn("Test bypassed because PTR server used does not support this feature.", FutureWarning)
            return
    
        field_display_name = "Project Visibility Test"
        field_name = "sg_{0}".format(field_display_name.lower().replace(" ", "_"))
    
        schema = self.sg.schema_field_read("Asset")
        # Ensure the custom field exists.
        if field_name not in schema:
            self.sg.schema_field_create("Asset", "text", "Project Visibility Test")
    
        # Grab any two projects that we can use for toggling the visible property with.
        projects = self.sg.find("Project", [], order=[{"field_name": "id", "direction": "asc"}])
        project_1 = projects[0]
        project_2 = projects[1]
    
        # First, reset the field visibility in a known state, i.e. visible for both projects,
        # in case the last test run failed midway through.
        self.sg.schema_field_update("Asset", field_name, {"visible": True}, project_1)
        self.assertEqual(
            {"value": True, "editable": True},
            self.sg.schema_field_read("Asset", field_name, project_1)[field_name]["visible"]
        )
        self.sg.schema_field_update("Asset", field_name, {"visible": True}, project_2)
        self.assertEqual(
            {"value": True, "editable": True},
            self.sg.schema_field_read("Asset", field_name, project_2)[field_name]["visible"]
        )
    
        # Built-in fields should remain not editable.
        self.assertFalse(self.sg.schema_field_read("Asset", "code")["code"]["visible"]["editable"])
    
        # Custom fields should be editable
        self.assertEqual(
            {"value": True, "editable": True},
            self.sg.schema_field_read("Asset", field_name)[field_name]["visible"]
        )
    
        # Hide the field on project 1
        self.sg.schema_field_update("Asset", field_name, {"visible": False}, project_1)
        # It should not be visible anymore.
>       self.assertEqual(
            {"value": False, "editable": True},
            self.sg.schema_field_read("Asset", field_name, project_1)[field_name]["visible"]
        )
E       AssertionError: {'value': False, 'editable': True} != {'value': True, 'editable': True}
E       - {'editable': True, 'value': False}
E       ?                             ^^^^
E       
E       + {'editable': True, 'value': True}
E       ?                             ^^^

tests\test_api.py:2941: AssertionError
Raw output
C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\unittest\case.py:676: AssertionError: {'value': False, 'editable': True} != {'value': True, 'editable': True}

Check failure on line 1 in tests/test_api.py::TestShotgunApi::test_work_schedule

See this annotation in the file changed.

@azure-pipelines azure-pipelines / shotgunsoftware.python-api

tests/test_api.py::TestShotgunApi::test_work_schedule

self = <tests.test_api.TestShotgunApi testMethod=test_work_schedule>

    def test_work_schedule(self):
        '''test_work_schedule tests WorkDayRules api'''
        self.maxDiff = None
    
        start_date = '2012-01-01'
        start_date_obj = datetime.datetime(2012, 1, 1)
        end_date = '2012-01-07'
        end_date_obj = datetime.datetime(2012, 1, 7)
    
        project = self.project
        # We're going to be comparing this value with the value returned from the server, so extract only the type, id
        # and name
        user = {"type": self.human_user["type"], "id": self.human_user["id"], "name": self.human_user["name"]}
    
        work_schedule = self.sg.work_schedule_read(start_date, end_date, project, user)
        # Test that the work_schedule_read api method is called with the 'start_date' and 'end_date' arguments
        # in the 'YYYY-MM-DD' string format.
        self.assertRaises(shotgun_api3.ShotgunError, self.sg.work_schedule_read,
                          start_date_obj, end_date_obj, project, user)
    
    
        resp = self.sg.work_schedule_update('2012-01-02', False, 'Studio Holiday')
        expected = {
            'date': '2012-01-02',
            'description': 'Studio Holiday',
            'project': None,
            'user': None,
            'working': False
        }
        self.assertEqual(expected, resp)
        resp = self.sg.work_schedule_read(start_date, end_date, project, user)
        work_schedule['2012-01-02'] = {"reason": "STUDIO_EXCEPTION", "working": False, "description": "Studio Holiday"}
        self.assertEqual(work_schedule, resp)
    
        resp = self.sg.work_schedule_update('2012-01-03', False, 'Project Holiday', project)
        expected = {
            'date': '2012-01-03',
            'description': 'Project Holiday',
            'project': project,
            'user': None,
            'working': False
        }
        self.assertEqual(expected, resp)
        resp = self.sg.work_schedule_read(start_date, end_date, project, user)
        work_schedule['2012-01-03'] = {
            "reason": "PROJECT_EXCEPTION",
            "working": False,
            "description": "Project Holiday"
        }
        self.assertEqual(work_schedule, resp)
    
        jan4 = datetime.datetime(2012, 1, 4)
    
        self.assertRaises(shotgun_api3.ShotgunError, self.sg.work_schedule_update,
                          jan4, False, 'Artist Holiday', user=user)
    
        resp = self.sg.work_schedule_update("2012-01-04", False, 'Artist Holiday',  user=user)
        expected = {
            'date': '2012-01-04',
            'description': 'Artist Holiday',
            'project': None,
            'user': user,
            'working': False
        }
        self.assertEqual(expected, resp)
        resp = self.sg.work_schedule_read(start_date, end_date, project, user)
        work_schedule['2012-01-04'] = {"reason": "USER_EXCEPTION", "working": False, "description": "Artist Holiday"}
>       self.assertEqual(work_schedule, resp)
E       AssertionError: {'201[92 chars]': {'reason': 'STUDIO_EXCEPTION', 'working': F[481 chars]EK'}} != {'201[92 chars]': {'working': True, 'description': None, 'rea[468 chars]EK'}}
E         {'2012-01-01': {'description': None,
E                         'reason': 'STUDIO_WORK_WEEK',
E                         'working': False},
E       -  '2012-01-02': {'description': 'Studio Holiday',
E       ?                                ^^^^^^ ^^^^^^^^^
E       
E       +  '2012-01-02': {'description': None,
E       ?                                ^ ^^
E       
E       -                 'reason': 'STUDIO_EXCEPTION',
E       ?                                    -- ^^^^^
E       
E       +                 'reason': 'STUDIO_WORK_WEEK',
E       ?                                   ++++++  ^
E       
E       -                 'working': False},
E       ?                            ^^^^
E       
E       +                 'working': True},
E       ?     
Raw output
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/unittest/case.py:676: AssertionError: {'201[92 chars]': {'reason': 'STUDIO_EXCEPTION', 'working': F[481 chars]EK'}} != {'201[92 chars]': {'working': True, 'description': None, 'rea[468 chars]EK'}}