def _create_model(self): suite = self._create_directory_suite("/top_suite") suite.children = [self._create_file_suite("sub_suite_%d.txt" % i) for i in range(3)] res = ResourceFile() res.source = "resource.txt" res.keyword_table.keywords.append(UserKeyword(res, "Resource Keyword")) model = ChiefController(Namespace(FakeSettings())) model._controller = TestDataDirectoryController(suite) rfc = ResourceFileController(res) model.resources.append(rfc) model._insert_into_suite_structure(rfc) return model
def _create_model(self): suite = self._create_directory_suite('/top_suite') suite.children = [self._create_file_suite('sub_suite_%d.txt' % i) for i in range(3)] res = ResourceFile() res.source = 'resource.txt' res.keyword_table.keywords.append(UserKeyword(res, 'Resource Keyword')) library_manager = LibraryManager(':memory:') library_manager.create_database() model = ChiefController(Namespace(FakeSettings()), library_manager=library_manager) model._controller = TestDataDirectoryController(suite) rfc = ResourceFileController(res, chief_controller=model) model.resources.append(rfc) model._insert_into_suite_structure(rfc) return model
def _create_model(self): suite = self._create_directory_suite('/top_suite') suite.children = [self._create_file_suite('sub_suite_%d.txt' % i) for i in range(3)] res = ResourceFile() res.source = 'resource.txt' res.keyword_table.keywords.append(UserKeyword(res, 'Resource Keyword')) library_manager = LibraryManager(':memory:') library_manager.create_database() model = ChiefController(Namespace(FakeSettings()), library_manager=library_manager) model._controller = TestDataDirectoryController(suite) rfc = ResourceFileController(res, chief_controller=model) model.resources.append(rfc) model.insert_into_suite_structure(rfc) return model
def test_reload_with_resource(self): controller_parent = lambda:0 controller_parent.children = [] controller_parent.add_child = controller_parent.children.append ctrl = ResourceFileController(ResourceFile(source=self._resource_path).populate(), parent=controller_parent) assert_equals(len(ctrl.keywords), 1) open(self._resource_path, 'a').write('Ninjaed Keyword Log I am taking over!\n') ctrl.reload() assert_equals(len(ctrl.keywords), 2) assert_equals(ctrl.keywords[-1].name, 'Ninjaed Keyword') assert_equals(ctrl.parent, controller_parent)
def _create_data(self, resource_name, resource_import): res_path = os.path.abspath(resource_name) tcf = TestCaseFile(source=os.path.abspath('test.txt')) tcf.setting_table.add_resource(resource_import) tcf.variable_table.add('${dirname}', os.path.abspath('.').replace('\\', '\\\\')) tcf.variable_table.add('${path}', os.path.abspath(resource_name).replace('\\', '\\\\')) library_manager = LibraryManager(':memory:') library_manager.create_database() self.project = Project(Namespace(FakeSettings()), FakeSettings(), library_manager) self.project._controller = TestCaseFileController(tcf, self.project) res = ResourceFile(source=res_path) self.res_controller = \ self.project._resource_file_controller_factory.create(res) self.project._namespace._resource_factory.cache[os.path.normcase(res_path)] = res
def reload(self): self.__init__(ResourceFile(source=self.filename).populate(), self._project, parent=self.parent)
def _set_resources(self, *paths): for p in paths: resource = ResourceFileController(ResourceFile( os.path.normpath(p))) self.project.resources.append(resource) self.project.insert_into_suite_structure(resource)
def datafileWithVariables(vars): data = ResourceFile() for var in vars: data.variable_table.add(var, vars[var]) return data
def reload(self): self.__init__(ResourceFile(source=self.filename).populate(), self._chief_controller, parent=self.parent)