def setUp(self): self._library_manager = _library_manager() self.ctrl = Project(Namespace(FakeSettings()), FakeSettings(), self._library_manager) self.load_observer = MessageRecordingLoadObserver() self.suite_listener = PublisherListener(RideOpenSuite) self.resource_listener = PublisherListener(RideOpenResource)
def _load(self, testcasefile): ns = Namespace(FakeSettings()) library_manager = LibraryManager(':memory:') library_manager.create_database() project = Project(ns, settings=ns._settings, library_manager=library_manager) project.load_datafile(testcasefile, MessageRecordingLoadObserver()) return ns, project._controller.data, library_manager
def test_load_dirty_controllers(self): self.ctrl.load_data(SUITEPATH, MessageRecordingLoadObserver()) assert_equals(len(self.ctrl._get_all_dirty_controllers()), 0) tcf = self._find_suite_by_type(self.ctrl.data.children, TestCaseFileController) tcf.create_test('newnessness') assert_equals(len(self.ctrl._get_all_dirty_controllers()), 1) self.ctrl.data.mark_dirty() assert_equals(len(self.ctrl._get_all_dirty_controllers()), 2) sub_dir = self._find_suite_by_type(self.ctrl.data.children, TestDataDirectoryController) sub_dir_tcf = self._find_suite_by_type(sub_dir.children, TestCaseFileController) sub_dir_tcf.create_test('newnessness') assert_equals(len(self.ctrl._get_all_dirty_controllers()), 3)
def test_sort_external_resources(self): self.ctrl.load_data(EXTERNAL_RES_UNSORTED_PATH, MessageRecordingLoadObserver()) assert_equal([res.name for res in self.ctrl.external_resources], ["Abc", "Bar", "Foo", "Hello", "Resource"])
def test_dirtyness(self): self.ctrl.load_data(COMPLEX_SUITE_PATH, MessageRecordingLoadObserver()) assert_true(not self.ctrl.is_dirty()) self.ctrl.data.create_test('newnessness') assert_true(self.ctrl.is_dirty())
def _get_file_controller(self, path): self.project.load_datafile(path, MessageRecordingLoadObserver()) return self.project._controller