예제 #1
0
    def test_no_settings(self, *unused_mocks):
        """
        Test the behaviour of the defaults manager when there are no settings.
        """
        instance = UserSettings._instance = Mock()
        instance.shotgun_proxy = None
        instance.default_site = self._CONFIG_HOST
        instance.default_login = self._CONFIG_USER
        instance.app_store_proxy = None

        dm = DefaultsManager()
        self.assertEqual(dm.get_host(), self._SESSION_CACHE_HOST)
        self.assertEqual(dm.get_login(), self._SESSION_CACHE_USER)
        self.assertIs(dm.get_http_proxy(), None)
예제 #2
0
    def test_empty_session_cache(self, *unused_mocks):
        """
        Test the behaviour of the defaults manager when the cache is empty
        and the config file is set.
        """
        instance = UserSettings._instance = Mock()
        instance.shotgun_proxy = self._CONFIG_HTTP_PROXY
        instance.default_site = self._CONFIG_HOST
        instance.default_login = self._CONFIG_USER

        dm = DefaultsManager()
        self.assertEqual(dm.get_host(), self._CONFIG_HOST)
        self.assertEqual(dm.get_login(), self._CONFIG_USER)
        self.assertIs(dm.get_http_proxy(), self._CONFIG_HTTP_PROXY)
예제 #3
0
    def test_no_settings(self, *unused_mocks):
        """
        Test the behaviour of the defaults manager when there are no settings.
        """
        instance = UserSettings._instance = Mock()
        instance.shotgun_proxy = None
        instance.default_site = self._CONFIG_HOST
        instance.default_login = self._CONFIG_USER
        instance.app_store_proxy = None

        dm = DefaultsManager()
        self.assertEqual(dm.get_host(), self._SESSION_CACHE_HOST)
        self.assertEqual(dm.get_login(), self._SESSION_CACHE_USER)
        self.assertIs(dm.get_http_proxy(), None)
예제 #4
0
    def test_empty_session_cache(self, *unused_mocks):
        """
        Test the behaviour of the defaults manager when the cache is empty
        and the config file is set.
        """
        instance = UserSettings._instance = Mock()
        instance.shotgun_proxy = self._CONFIG_HTTP_PROXY
        instance.default_site = self._CONFIG_HOST
        instance.default_login = self._CONFIG_USER

        dm = DefaultsManager()
        self.assertEqual(dm.get_host(), self._CONFIG_HOST)
        self.assertEqual(dm.get_login(), self._CONFIG_USER)
        self.assertIs(dm.get_http_proxy(), self._CONFIG_HTTP_PROXY)
예제 #5
0
 def test_fixed_host_on_init_overrides_everything(self, _):
     fixed_host = "https://my-custom-host.shotgunstudio.com"
     dm = DefaultsManager(fixed_host)
     self.assertEqual(dm.is_host_fixed(), True)
     self.assertEqual(dm.get_host(), fixed_host)
예제 #6
0
 def test_fixed_host_on_init_overrides_everything(self, _):
     fixed_host = "https://my-custom-host.shotgunstudio.com"
     dm = DefaultsManager(fixed_host)
     self.assertEqual(dm.is_host_fixed(), True)
     self.assertEqual(dm.get_host(), fixed_host)