def test_add_test_or_kw(self): assert_equal(len(self.ctrl.tests), 0) new_test = TestCaseController(self.ctrl, TestCase(TestCaseFile(), 'New test')) self.ctrl.add_test_or_keyword(new_test) assert_equal(len(self.ctrl.tests), 1) assert_true(self.ctrl.tests[0]._test.parent.parent is self.ctrl.datafile) assert_true(self.ctrl.dirty)
def _create_test(self, name='test'): suite = TestCaseFile(source='suite') suite_controller = TestCaseFileController(suite) parent = TestCaseTableController(suite_controller, suite.testcase_table) test = TestCase(parent=lambda: 0, name=name) return TestCaseController(parent, test)
def setUp(self): self.tcf = TestCaseFile() self.testcase = self.tcf.testcase_table.add('Test') self.testcase.add_step(['Log', 'Hello']) self.testcase.add_step(['No Operation']) self.testcase.add_step(['Foo']) self.tcf.testcase_table.add('Another Test') tctablectrl = TestCaseTableController(TestCaseFileController(self.tcf), self.tcf.testcase_table) self.ctrl = TestCaseController(tctablectrl, self.testcase)
def _test(self, name='name', tags=None, doc='documentation'): parent = lambda: 0 parent.datafile_controller = parent parent.register_for_namespace_updates = lambda *_: 0 parent.force_tags = [] parent.default_tags = [] robot_test = TestCase(parent=parent, name=name) robot_test.get_setter('documentation')(doc) robot_test.get_setter('tags')(tags or []) test = TestCaseController(parent, robot_test) return test
class TestCaseControllerTest(_BaseWithSteps): def setUp(self): self.tcf = TestCaseFile() self.testcase = self.tcf.testcase_table.add('Test') self.testcase.add_step(['Log', 'Hello']) self.testcase.add_step(['No Operation']) self.testcase.add_step(['Foo']) self.tcf.testcase_table.add('Another Test') tctablectrl = TestCaseTableController(TestCaseFileController(self.tcf), self.tcf.testcase_table) self.ctrl = TestCaseController(tctablectrl, self.testcase) def test_creation(self): for st in self.ctrl.settings: assert_true(st is not None) assert_true(self.ctrl.datafile is self.tcf, self.ctrl.datafile) def test_rename(self): self.ctrl.rename('Foo Barness') assert_equals(self.ctrl.name, 'Foo Barness') assert_true(self.ctrl.dirty) def test_rename_strips_whitespace(self): self.ctrl.rename('\t \n Foo Barness ') assert_equals(self.ctrl.name, 'Foo Barness') assert_true(self.ctrl.dirty) def test_copy_empty(self): self._test_copy_empty() def test_copy_content(self): self._test_copy_content() def test_add_tag(self): orig_num_tags = len(self.ctrl.tags.as_list()) self.ctrl.add_tag('Some tag') assert_true(len(self.ctrl.tags.as_list()) == orig_num_tags + 1)
class TestCaseControllerTest(_BaseWithSteps): def setUp(self): self.tcf = TestCaseFile() self.testcase = self.tcf.testcase_table.add('Test') self.testcase.add_step(['Log', 'Hello']) self.testcase.add_step(['No Operation']) self.testcase.add_step(['Foo']) self.tcf.testcase_table.add('Another Test') tctablectrl = TestCaseTableController(TestCaseFileController(self.tcf), self.tcf.testcase_table) self.ctrl = TestCaseController(tctablectrl, self.testcase) def test_creation(self): for st in self.ctrl.settings: assert_true(st is not None) assert_true(self.ctrl.datafile is self.tcf, self.ctrl.datafile) def test_rename(self): self.ctrl.rename('Foo Barness') assert_equal(self.ctrl.name, 'Foo Barness') assert_true(self.ctrl.dirty) def test_rename_strips_whitespace(self): self.ctrl.rename('\t \n Foo Barness ') assert_equal(self.ctrl.name, 'Foo Barness') assert_true(self.ctrl.dirty) def test_copy_empty(self): self._test_copy_empty() def test_copy_content(self): self._test_copy_content() def test_add_tag(self): orig_num_tags = len(self.ctrl.tags.as_list()) self.ctrl.add_tag('Some tag') assert_true(len(self.ctrl.tags.as_list()) == orig_num_tags + 1)
def setUp(self): controller = TestCaseController(IncredibleMock(), IncredibleMock()) plugin = FakePlugin({}, controller) self.tc_editor = TestCaseEditor(plugin, wx.Frame(None), controller, None)