Beispiel #1
0
    def test_serialize_with_user(self):
        """
        Make sure the user is serialized and restored.
        """
        tank.set_authenticated_user(self._user)
        ctx = context.Context(**self.kws)
        ctx_str = tank.Context.serialize(ctx)

        # Reset the current user to later check if it is restored.
        tank.set_authenticated_user(None)

        # Unserializing should restore the user.
        tank.Context.deserialize(ctx_str)
        self._assert_same_user(tank.get_authenticated_user(), self._user)
Beispiel #2
0
    def test_serialize_with_user(self):
        """
        Make sure the user is serialized and restored.
        """
        tank.set_authenticated_user(self._user)
        ctx = context.Context(**self.kws)
        ctx_str = tank.Context.serialize(ctx)

        # Reset the current user to later check if it is restored.
        tank.set_authenticated_user(None)

        # Unserializing should restore the user.
        tank.Context.deserialize(ctx_str)
        self._assert_same_user(tank.get_authenticated_user(), self._user)
Beispiel #3
0
    def test_serialize_without_user(self):
        """
        Make sure the user is not serialized and not restored.
        """
        tank.set_authenticated_user(self._user)
        ctx = context.Context(**self.kws)
        ctx_str = tank.Context.serialize(ctx)

        # Change the current user to make sure that the deserialize operation doesn't
        # change it back to the original user.
        other_user = ShotgunAuthenticator().create_script_user(
            "script_user", "script_key", "https://abc.shotgunstudio.com")
        tank.set_authenticated_user(other_user)

        # The unserialized context shouldn't have changed the current user.
        tank.Context.deserialize(ctx_str)
        self._assert_same_user(tank.get_authenticated_user(), other_user)
Beispiel #4
0
    def test_serialize_without_user(self):
        """
        Make sure the user is not serialized and not restored.
        """
        tank.set_authenticated_user(self._user)
        ctx = context.Context(**self.kws)
        ctx_str = tank.Context.serialize(ctx)

        # Change the current user to make sure that the deserialize operation doesn't
        # change it back to the original user.
        other_user = ShotgunAuthenticator().create_script_user(
            "script_user", "script_key", "https://abc.shotgunstudio.com"
        )
        tank.set_authenticated_user(other_user)

        # The unserialized context shouldn't have changed the current user.
        tank.Context.deserialize(ctx_str)
        self._assert_same_user(tank.get_authenticated_user(), other_user)