Skip to content

Add created_at for upload url

ceb2409
Select commit
Loading
Failed to load commit list.
Open

SG-41387 Add parameter created_at for sg.upload #444

Add created_at for upload url
ceb2409
Select commit
Loading
Failed to load commit list.
Azure Pipelines / python-api failed Mar 18, 2026 in 11m 26s

Build #20260318.1 had test failures

Details

Tests

  • Failed: 25 (0.44%)
  • Passed: 5,663 (99.56%)
  • Other: 0 (0.00%)
  • Total: 5,688

Annotations

Check failure on line 471 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python-api

Build log #L471

Bash exited with code '1'.

Check failure on line 488 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python-api

Build log #L488

Bash exited with code '1'.

Check failure on line 466 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python-api

Build log #L466

Bash exited with code '1'.

Check failure on line 462 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python-api

Build log #L462

Bash exited with code '1'.

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

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python-api

tests/test_api.py::TestShotgunApi::test_upload_to_sg_with_created_at

self = <tests.test_api.TestShotgunApi testMethod=test_upload_to_sg_with_created_at>
mock_send_form = <MagicMock name='_send_form' id='139676695395824'>

    @unittest.mock.patch("shotgun_api3.Shotgun._send_form")
    def test_upload_to_sg_with_created_at(self, mock_send_form):
        """
        Verify that created_at is passed as a form parameter when uploading
        non-thumbnail attachments via _upload_to_sg().
        """
        self.sg.server_info["s3_direct_uploads_enabled"] = False
        mock_send_form.return_value = "1\n:456\nasd"
        this_dir, _ = os.path.split(__file__)
        u_path = os.path.abspath(
            os.path.expanduser(glob.glob(os.path.join(this_dir, "Noëlご.jpg"))[0])
        )
        custom_time = datetime.datetime(2026, 2, 15, 10, 30, 0)
        self.sg.upload(
            "Version",
            self.version["id"],
            u_path,
            "attachments",
            created_at=custom_time,
        )
        mock_send_form.assert_called_once()
        mock_send_form_args, _ = mock_send_form.call_args
        params = mock_send_form_args[1]
        self.assertIn("created_at", params)
>       self.assertEqual(params["created_at"], custom_time)
E       AssertionError: '2026-02-15T10:30:00' != datetime.datetime(2026, 2, 15, 10, 30)

tests/test_api.py:352: AssertionError
Raw output
/opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/unittest/case.py:838: AssertionError: '2026-02-15T10:30:00' != datetime.datetime(2026, 2, 15, 10, 30)

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

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python-api

tests/test_api.py::TestShotgunApi::test_upload_to_sg_with_created_at

self = <tests.test_api.TestShotgunApi testMethod=test_upload_to_sg_with_created_at>
mock_send_form = <MagicMock name='_send_form' id='139702472382224'>

    @unittest.mock.patch("shotgun_api3.Shotgun._send_form")
    def test_upload_to_sg_with_created_at(self, mock_send_form):
        """
        Verify that created_at is passed as a form parameter when uploading
        non-thumbnail attachments via _upload_to_sg().
        """
        self.sg.server_info["s3_direct_uploads_enabled"] = False
        mock_send_form.return_value = "1\n:456\nasd"
        this_dir, _ = os.path.split(__file__)
        u_path = os.path.abspath(
            os.path.expanduser(glob.glob(os.path.join(this_dir, "Noëlご.jpg"))[0])
        )
        custom_time = datetime.datetime(2026, 2, 15, 10, 30, 0)
        self.sg.upload(
            "Version",
            self.version["id"],
            u_path,
            "attachments",
            created_at=custom_time,
        )
        mock_send_form.assert_called_once()
        mock_send_form_args, _ = mock_send_form.call_args
        params = mock_send_form_args[1]
        self.assertIn("created_at", params)
>       self.assertEqual(params["created_at"], custom_time)
E       AssertionError: '2026-02-15T10:30:00' != datetime.datetime(2026, 2, 15, 10, 30)

tests/test_api.py:352: AssertionError
Raw output
/opt/hostedtoolcache/Python/3.11.15/x64/lib/python3.11/unittest/case.py:866: AssertionError: '2026-02-15T10:30:00' != datetime.datetime(2026, 2, 15, 10, 30)

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

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python-api

tests/test_api.py::TestShotgunApi::test_upload_to_sg_with_created_at

self = <tests.test_api.TestShotgunApi testMethod=test_upload_to_sg_with_created_at>
mock_send_form = <MagicMock name='_send_form' id='140703924261264'>

    @unittest.mock.patch("shotgun_api3.Shotgun._send_form")
    def test_upload_to_sg_with_created_at(self, mock_send_form):
        """
        Verify that created_at is passed as a form parameter when uploading
        non-thumbnail attachments via _upload_to_sg().
        """
        self.sg.server_info["s3_direct_uploads_enabled"] = False
        mock_send_form.return_value = "1\n:456\nasd"
        this_dir, _ = os.path.split(__file__)
        u_path = os.path.abspath(
            os.path.expanduser(glob.glob(os.path.join(this_dir, "Noëlご.jpg"))[0])
        )
        custom_time = datetime.datetime(2026, 2, 15, 10, 30, 0)
        self.sg.upload(
            "Version",
            self.version["id"],
            u_path,
            "attachments",
            created_at=custom_time,
        )
        mock_send_form.assert_called_once()
        mock_send_form_args, _ = mock_send_form.call_args
        params = mock_send_form_args[1]
        self.assertIn("created_at", params)
>       self.assertEqual(params["created_at"], custom_time)
E       AssertionError: '2026-02-15T10:30:00' != datetime.datetime(2026, 2, 15, 10, 30)

tests/test_api.py:352: AssertionError
Raw output
/opt/hostedtoolcache/Python/3.9.25/x64/lib/python3.9/unittest/case.py:830: AssertionError: '2026-02-15T10:30:00' != datetime.datetime(2026, 2, 15, 10, 30)

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

See this annotation in the file changed.

@azure-pipelines azure-pipelines / python-api

tests/test_api.py::TestShotgunApi::test_upload_to_sg_with_created_at

self = <tests.test_api.TestShotgunApi testMethod=test_upload_to_sg_with_created_at>
mock_send_form = <MagicMock name='_send_form' id='4549888976'>

    @unittest.mock.patch("shotgun_api3.Shotgun._send_form")
    def test_upload_to_sg_with_created_at(self, mock_send_form):
        """
        Verify that created_at is passed as a form parameter when uploading
        non-thumbnail attachments via _upload_to_sg().
        """
        self.sg.server_info["s3_direct_uploads_enabled"] = False
        mock_send_form.return_value = "1\n:456\nasd"
        this_dir, _ = os.path.split(__file__)
        u_path = os.path.abspath(
            os.path.expanduser(glob.glob(os.path.join(this_dir, "Noëlご.jpg"))[0])
        )
        custom_time = datetime.datetime(2026, 2, 15, 10, 30, 0)
        self.sg.upload(
            "Version",
            self.version["id"],
            u_path,
            "attachments",
            created_at=custom_time,
        )
        mock_send_form.assert_called_once()
        mock_send_form_args, _ = mock_send_form.call_args
        params = mock_send_form_args[1]
        self.assertIn("created_at", params)
>       self.assertEqual(params["created_at"], custom_time)
E       AssertionError: '2026-02-15T10:30:00' != datetime.datetime(2026, 2, 15, 10, 30)

tests/test_api.py:352: AssertionError
Raw output
/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/unittest/case.py:866: AssertionError: '2026-02-15T10:30:00' != datetime.datetime(2026, 2, 15, 10, 30)