@@ -0,0 +1,2152 @@
+# coding=utf-8%0A%0Aimport sys%0Aimport struct%0Aimport unittest%0Afrom test_000_config import TestConfig%0Afrom test_020_connection import TestConnection%0A%0Afrom gi.repository import Midgard%0Afrom gi.repository import GObject%0A%0Aclass TestWorkspace(unittest.TestCase):%0A  mgd = None%0A  manager = None%0A%0A  def setUp(self):%0A    if self.mgd is None:%0A      self.mgd = TestConnection.openConnection()%0A    if self.manager is None:%0A      self.manager = Midgard.WorkspaceManager(connection = self.mgd)%0A%0A  def tearDown(self):        %0A    self.mgd.close()%0A    self.mgd = None%0A%0A  def createWorkspaces(self):%0A    ws_foo = Midgard.Workspace(name = %22Foo%22)%0A    self.manager.create_workspace(ws_foo, %22%22)%0A    ws_bar = Midgard.Workspace(name = %22Bar%22)%0A    self.manager.create_workspace(ws_bar, %22/Foo%22)%0A    ws_baz = Midgard.Workspace(name = %22Baz%22)%0A    self.manager.create_workspace(ws_baz, %22/Foo%22)%0A%0A  def testAListWorkspacesNames(self):%0A    self.createWorkspaces()%0A    ws = Midgard.Workspace()%0A    self.manager.get_workspace_by_path(ws, %22/Foo%22)%0A    names = ws.list_workspace_names()%0A    self.assertEqual(len(names), 2)%0A    self.assertIn(%22Bar%22, names)%0A    self.assertIn(%22Baz%22, names)%0A%0A  def testListChildren(self):%0A    ws = Midgard.Workspace()%0A    self.manager.get_workspace_by_path(ws, %22/Foo%22)%0A    children = ws.list_children()%0A    names = %7B%22Bar%22, %22Baz%22%7D%0A    self.assertEqual(len(children), 2)%0A    self.assertIn(children%5B0%5D.get_property(%22name%22), names)%0A    self.assertIn(children%5B1%5D.get_property(%22name%22), names)%0A%0A  def testGetPath(self):%0A    ws = Midgard.Workspace()%0A    self.manager.get_workspace_by_path(ws, %22/Foo%22)%0A    self.assertEqual(ws.get_path(), %22/Foo%22);%0A%0A    ws = Midgard.Workspace()%0A    self.manager.get_workspace_by_path(ws, %22/Foo/Bar%22)%0A    self.assertEqual(ws.get_path(), %22/Foo/Bar%22);%0A%0A    ws = Midgard.Workspace()%0A    self.manager.get_workspace_by_path(ws, %22/Foo/Baz%22)%0A    self.assertEqual(ws.get_path(), %22/Foo/Baz%22);%0A%0A  def testInheritance(self): %0A    ws = Midgard.Workspace()%0A    self.assertIsInstance(ws, GObject.GObject)%0A    self.assertIsInstance(ws, Midgard.Workspace)%0A    self.assertIsInstance(ws, Midgard.WorkspaceStorage)%0A%0Aif __name__ == %22__main__%22:%0A    unittest.main()%0A

Test workspace. Initial. Closes gh-181