本文整理汇总了Python中robotide.controller.ChiefController.insert_into_suite_structure方法的典型用法代码示例。如果您正苦于以下问题:Python ChiefController.insert_into_suite_structure方法的具体用法?Python ChiefController.insert_into_suite_structure怎么用?Python ChiefController.insert_into_suite_structure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类robotide.controller.ChiefController
的用法示例。
在下文中一共展示了ChiefController.insert_into_suite_structure方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestResolvingResourceDirectories
# 需要导入模块: from robotide.controller import ChiefController [as 别名]
# 或者: from robotide.controller.ChiefController import insert_into_suite_structure [as 别名]
class TestResolvingResourceDirectories(unittest.TestCase):
def setUp(self):
self.chief = ChiefController(Namespace(FakeSettings()), FakeSettings(), _library_manager())
def tearDown(self):
self.chief.close()
def test_resource_file_outside_of_topsuite_is_an_external_resource(self):
self._set_data_directory_controller('suite')
self._set_resources(j('foo','resource.txt'))
assert_equals(self.chief.external_resources, self.chief.resources)
def _set_data_directory_controller(self, dir):
self.chief._controller = TestDataDirectoryController(_data_directory(dir))
def test_resource_file_in_own_directory_is_added_to_top_suite(self):
self._set_data_directory_controller('foo')
self._set_resources(j('foo','bar','quux.txt'))
self._assert_resource_dir_was_created_as_child_of(self.chief.data)
self._assert_resource_dir_contains_resources()
assert_true(len(self.chief.external_resources)== 0)
def test_two_resource_in_same_directory_get_same_parent(self):
self._set_data_directory_controller('foo')
self._set_resources(j('foo','bar','quux.txt'), j('foo','bar','zap.txt'))
self._assert_resource_dir_was_created_as_child_of(self.chief.data)
self._assert_resource_dir_contains_resources()
def test_two_nested_resources_in_same_directory_get_same_parent(self):
self._set_data_directory_controller('suite')
self._set_resources(j('suite','foo','bar','quux.txt'), j('suite','foo','bar','zap.txt'))
assert_equals(self.chief.data.children[0].children[0].children,
self.chief.resources)
def test_resource_directory_gets_nearest_possible_parent(self):
self._set_data_directory_controller('tmp')
self.chief.data.add_child(TestDataDirectoryController(_data_directory(j('tmp','some'))))
self._set_resources(j('tmp','some','resoruces','res.txt'))
assert_equals(len(self.chief.data.children), 1)
assert_equals(len(self.chief.data.children[0].children), 1)
assert_equals(self.chief.data.children[0].children[0].children, [self.chief.resources[0]])
def test_nested_resource_directories(self):
self._set_data_directory_controller('tmp')
self._set_resources(j('tmp','resoruces','res.txt'), j('tmp','resoruces','more','res.txt'))
assert_equals(len(self.chief.data.children), 1)
assert_equals(len(self.chief.data.children[0].children), 2)
assert_equals(self.chief.data.children[0].children[1].children, [self.chief.resources[1]])
def test_resource_in_nested_directory(self):
self._set_data_directory_controller('tmp')
self._set_resources(j('tmp','res','ources','res.txt'))
assert_equals(len(self.chief.data.children), 1)
assert_equals(len(self.chief.data.children[0].children), 1)
assert_equals(self.chief.data.children[0].children[0].children, [self.chief.resources[0]])
assert_true(len(self.chief.external_resources)== 0)
def _set_resources(self, *paths):
for p in paths:
resource = ResourceFileController(ResourceFile(os.path.normpath(p)))
self.chief.resources.append(resource)
self.chief.insert_into_suite_structure(resource)
def _assert_resource_dir_was_created_as_child_of(self, ctrl):
assert_equals(len(ctrl.children), 1)
def _assert_resource_dir_contains_resources(self):
assert_equals(self.chief.data.children[0].children, self.chief.resources)