Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Jan 30, 2024
1 parent bdbcba5 commit 9f05293
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions test/unittests/test_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@


class TestGuiPage(unittest.TestCase):
def test_gui_page_legacy(self):
uri = __file__
name = "test"
persistent = True
duration = 0
page = GuiPage(uri, name, persistent, duration)
self.assertEqual(page.url, uri)
self.assertEqual(page.name, name)
self.assertEqual(page.persistent, persistent)
self.assertEqual(page.duration, 0)
self.assertFalse(page.active)
self.assertEqual(page.id, page.url)
self.assertEqual(page.get_uri(), page.url)
self.assertEqual(page.get_uri("qt6", "http://0.0.0.0:80"), page.url)
self.assertEqual(page.get_uri("qt6", "/var/www/app"), page.url)

def test_gui_page_from_server(self):
name = "test_page"
Expand All @@ -12,7 +27,7 @@ def test_gui_page_from_server(self):
page_id = "test_page"
namespace = "skill.test"

page = GuiPage(name, persistent, duration, page_id, namespace)
page = GuiPage(None, name, persistent, duration, page_id, namespace)
qt5 = page.get_uri(server_url="localhost:80")
self.assertEqual(qt5,
f"http://localhost:80/{namespace}/qt5/{page_id}.qml")
Expand All @@ -28,7 +43,7 @@ def test_gui_page_from_mapped_path(self):
page_id = "test_page"
namespace = "skill.test"

page = GuiPage(name, persistent, duration, page_id, namespace)
page = GuiPage(None, name, persistent, duration, page_id, namespace)
qt5 = page.get_uri(server_url="/path/for/gui/client")
self.assertEqual(qt5,
f"file:///path/for/gui/client/{namespace}/qt5/{page_id}.qml")
Expand All @@ -45,7 +60,8 @@ def test_gui_page_from_local_path(self):
namespace = "skill.test"
res_dirs = {"all": join(dirname(__file__), "mock_data", "gui")}
# Modern GUI File organization
page = GuiPage(name, persistent, duration, page_id, namespace, res_dirs)
page = GuiPage(None, name, persistent, duration, page_id, namespace,
res_dirs)
qt5 = page.get_uri("qt5")
qt6 = page.get_uri("qt6")
self.assertTrue(isfile(qt5))
Expand Down

0 comments on commit 9f05293

Please sign in to comment.