Esempio n. 1
0
        def _run_test(self, site, source_proxy, source_store_proxy,
                      expected_store_proxy):
            """
            Should be implemented by derived classes in order to mock authentication
            for the test.

            :param site: Site used for authentication
            :param source_proxy: proxy being returned by the authentication code for the site
            :param source_store_proxy: proxy being return by the authentication for the app store.
            :param expected_store_proxy: actual proxy value
            """
            # Make sure that the site uses the host and proxy.
            sg = tank.util.shotgun.create_sg_connection()
            self.assertEqual(sg.base_url, self._SITE)
            self.assertEqual(sg.config.raw_http_proxy, source_proxy)

            descriptor = IODescriptorAppStore(
                {
                    "name": "tk-multi-app",
                    "version": "v0.0.1",
                    "type": "app_store"
                }, sg, Descriptor.CORE)
            http_proxy = descriptor._IODescriptorAppStore__get_app_store_proxy_setting(
            )
            self.assertEqual(http_proxy, expected_store_proxy)
Esempio n. 2
0
    def _test_patched(self, mock_store):
        """
        Tests that the mock_store parameter is the MockStore and that
        the TankAppStoreDescriptor class has been properly patched.
        """
        # Make sure this is the mock store.
        self.assertIsInstance(mock_store, MockStore)
        # Register an engine with it.
        mock_store.add_engine("tk-test", "v1.2.3")

        from tank.descriptor.io_descriptor.appstore import IODescriptorAppStore

        # Make sure the created object is actually an instance of the mocked descriptor class.
        self.assertIsInstance(
            IODescriptorAppStore(
                {
                    "name": "tk-test",
                    "type": "app_store",
                    "version": "v1.2.3"
                },
                None,
                Descriptor.ENGINE,
            ),
            TankMockStoreDescriptor,
        )
        def _run_test(self, site, source_proxy, source_store_proxy, expected_store_proxy):
            """
            Should be implemented by derived classes in order to mock authentication
            for the test.

            :param site: Site used for authentication
            :param source_proxy: proxy being returned by the authentication code for the site
            :param source_store_proxy: proxy being return by the authentication for the app store.
            :param expected_store_proxy: actual proxy value
            """
            # Make sure that the site uses the host and proxy.
            sg = tank.util.shotgun.create_sg_connection()
            self.assertEqual(sg.base_url, self._SITE)
            self.assertEqual(sg.config.raw_http_proxy, source_proxy)

            descriptor = IODescriptorAppStore(
                {"name": "tk-multi-app", "version": "v0.0.1", "type": "app_store"},
                sg, Descriptor.CORE
            )
            http_proxy = descriptor._IODescriptorAppStore__get_app_store_proxy_setting()
            self.assertEqual(http_proxy, expected_store_proxy)