import carb.tokens
import omni.kit.app
import omni.kit.test

import os
import sys
from pathlib import Path


class TestAppAPI(omni.kit.test.AsyncTestCase):
    async def test_tokens(self):
        resolve = carb.tokens.get_tokens_interface().resolve

        ABS_TOKENS = ["${cache}", "${kit}", "${data}", "${logs}", "${app}", "${temp}"]
        for t in ABS_TOKENS:
            path = resolve(t)
            self.assertTrue(os.path.isabs(path))
            self.assertTrue(os.path.exists(path))

        python_exe = sys.prefix + "/" + ("python.exe" if sys.platform == "win32" else "bin/python3")
        self.assertEqual(os.path.normpath(resolve("${python}")), os.path.normpath(python_exe))
