本文整理汇总了Python中robotide.controller.filecontrollers.TestCaseFileController类的典型用法代码示例。如果您正苦于以下问题:Python TestCaseFileController类的具体用法?Python TestCaseFileController怎么用?Python TestCaseFileController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestCaseFileController类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_reload
def test_reload(self):
ctrl = TestCaseFileController(TestCaseFile(source=self._filepath).populate())
assert_equals(len(ctrl.tests), 1)
open(self._filepath, 'a').write('Second Test Log Hello World!\n')
ctrl.reload()
assert_equals(len(ctrl.tests), 2)
assert_equals(ctrl.tests[-1].name, 'Second Test')
开发者ID:IlfirinPL,项目名称:RIDE,代码行数:7,代码来源:test_modifcations_on_disk.py
示例2: TestCaseNameValidationTest
class TestCaseNameValidationTest(unittest.TestCase):
def setUp(self):
self.ctrl = TestCaseFileController(TestCaseFile()).tests
def test_valid_name(self):
self._validate_name(VALID_NAME, True)
def test_empty_name(self):
self._validate_name('', False)
def test_name_with_only_whitespace(self):
self._validate_name(' ', False)
def test_duplicate_name(self):
self.ctrl.new(VALID_NAME)
self._validate_name(VALID_NAME, False)
self._validate_name(VALID_NAME.upper(), False)
self._validate_name(VALID_NAME.replace(' ', '_'), False)
def test_duplicate_name_when_previous_name_known(self):
ctrl = self.ctrl.new(VALID_NAME)
self._validate_name(VALID_NAME, True, ctrl)
self._validate_name(VALID_NAME.upper(), True, ctrl)
self._validate_name(VALID_NAME.replace(' ', '_'), True, ctrl)
def _validate_name(self, name, expected_valid, named_ctrl=None):
valid = not bool(self.ctrl.validate_name(name, named_ctrl).error_message)
assert_equals(valid, expected_valid)
开发者ID:Garjy,项目名称:RIDE,代码行数:29,代码来源:test_tablecontrollers.py
示例3: test_overwrite
def test_overwrite(self):
ctrl = TestCaseFileController(TestCaseFile(source=self._filepath).populate(),
ChiefController(Namespace()))
os.utime(self._filepath, (1,1))
assert_true(ctrl.has_been_modified_on_disk())
ctrl.save()
assert_false(ctrl.has_been_modified_on_disk())
开发者ID:IlfirinPL,项目名称:RIDE,代码行数:7,代码来源:test_modifcations_on_disk.py
示例4: test_overwrite
def test_overwrite(self):
ctrl = TestCaseFileController(TestCaseFile(source=self._filepath).populate(),
create_project())
os.utime(self._filepath, (1,1))
assert_true(ctrl.has_been_modified_on_disk())
ctrl.execute(SaveFile())
assert_false(ctrl.has_been_modified_on_disk())
开发者ID:Hariprasad-ka,项目名称:RIDE,代码行数:7,代码来源:test_modifications_on_disk.py
示例5: setUp
def setUp(self):
self.tcf = TestCaseFile()
filectrl = TestCaseFileController(self.tcf)
filectrl.resource_import_modified = Mock()
resource_file_controller_mock = lambda:0
resource_file_controller_mock.add_known_import = lambda *_:0
resu_factory_mock = lambda:0
resu_factory_mock.find_with_import = lambda *_: resource_file_controller_mock
self.ctrl = ImportSettingsController(filectrl, self.tcf.setting_table, resu_factory_mock)
开发者ID:Acidburn0zzz,项目名称:RIDE,代码行数:9,代码来源:test_controllers.py
示例6: _create_suite_structure_with_two_tests_with_same_name
def _create_suite_structure_with_two_tests_with_same_name(self):
directory_controller = TestDataDirectoryController(_data_directory('Ro.ot'))
suite1_controller = TestCaseFileController(_testcasefile('Suite.1.txt'))
test1 = suite1_controller.create_test('Te.st')
suite2_controller = TestCaseFileController(_testcasefile('Suite.2.txt'))
test2 = suite2_controller.create_test('Te.st')
directory_controller.add_child(suite1_controller)
directory_controller.add_child(suite2_controller)
self.project._controller = directory_controller
return test1, test2
开发者ID:Hariprasad-ka,项目名称:RIDE,代码行数:10,代码来源:test_chiefcontroller.py
示例7: test_reload
def test_reload(self):
controller_parent = object()
model_parent = object()
ctrl = TestCaseFileController(
TestCaseFile(parent=model_parent, source=self._filepath).populate(),
parent=controller_parent)
assert_equals(len(ctrl.tests), 1)
open(self._filepath, 'a').write('Second Test Log Hello World!\n')
ctrl.reload()
assert_equals(len(ctrl.tests), 2)
assert_equals(ctrl.tests[-1].name, 'Second Test')
assert_equals(ctrl.parent, controller_parent)
assert_equals(ctrl.data.parent, model_parent)
开发者ID:Hariprasad-ka,项目名称:RIDE,代码行数:13,代码来源:test_modifications_on_disk.py
示例8: test_finding_correct_testcase_when_two_files_with_same_name_start
def test_finding_correct_testcase_when_two_files_with_same_name_start(self):
directory_controller = TestDataDirectoryController(_data_directory('t'))
suite1_controller = TestCaseFileController(_testcasefile('test.txt'))
test1 = suite1_controller.create_test('A')
suite2_controller = TestCaseFileController(_testcasefile('test2.txt'))
test2 = suite2_controller.create_test('A')
directory_controller.add_child(suite1_controller)
directory_controller.add_child(suite2_controller)
self.project._controller = directory_controller
result1 = self.project.find_controller_by_longname('T.'+test1.longname, test1.display_name)
assert_equals(result1, test1)
result2 = self.project.find_controller_by_longname('T.'+test2.longname, test2.display_name)
assert_equals(result2, test2)
开发者ID:Hariprasad-ka,项目名称:RIDE,代码行数:13,代码来源:test_chiefcontroller.py
示例9: TestCaseFileControllerTest
class TestCaseFileControllerTest(unittest.TestCase):
SOURCE_HTML = os.path.abspath(os.path.join('tmp', '.path.with.dots', 'test.cases.html'))
SOURCE_TXT = SOURCE_HTML.replace('.html', '.txt')
def setUp(self):
self.ctrl = TestCaseFileController(TestCaseFile(source=self.SOURCE_HTML))
def test_creation(self):
for st in self.ctrl.settings:
assert_true(st is not None)
assert_equals(len(self.ctrl.settings), 9)
assert_false(self.ctrl.dirty)
def test_has_format(self):
assert_true(self.ctrl.has_format())
def test_get_format(self):
assert_equals(self.ctrl.get_format(), 'html')
def test_source(self):
assert_equals(self.ctrl.filename, self.SOURCE_HTML)
def test_longname(self):
assert_equals(self.ctrl.longname, 'Test.Cases')
self.ctrl.parent = lambda:0
self.ctrl.parent.longname = 'Parent'
assert_equals(self.ctrl.longname, 'Parent.Test.Cases')
def test_set_format(self):
self.ctrl.set_format('txt')
assert_equals(self.ctrl.filename, self.SOURCE_TXT)
def test_add_test_or_kw(self):
assert_equals(len(self.ctrl.tests), 0)
new_test = TestCaseController(self.ctrl, TestCase(TestCaseFile(), 'New test'))
self.ctrl.add_test_or_keyword(new_test)
assert_equals(len(self.ctrl.tests), 1)
assert_true(self.ctrl.tests[0]._test.parent.parent is self.ctrl.datafile)
assert_true(self.ctrl.dirty)
def test_new_test(self):
test_ctrl = self.ctrl.create_test('Foo')
assert_equals(test_ctrl.name, 'Foo')
def test_create_keyword(self):
kw_ctrl = self.ctrl.create_keyword('An UK')
assert_equals(kw_ctrl.name, 'An UK')
def test_create_keyword_with_args(self):
kw_ctrl = self.ctrl.create_keyword('UK', '${a1} | ${a2}')
assert_equals(kw_ctrl.name, 'UK')
assert_equals(kw_ctrl.data.args.value, ['${a1}', '${a2}'])
开发者ID:Garjy,项目名称:RIDE,代码行数:52,代码来源:test_filecontrollers.py
示例10: TestCaseFileControllerTest
class TestCaseFileControllerTest(unittest.TestCase):
SOURCE_HTML = os.path.abspath(os.path.join("tmp", ".path.with.dots", "test.cases.html"))
SOURCE_TXT = SOURCE_HTML.replace(".html", ".txt")
def setUp(self):
self.ctrl = TestCaseFileController(TestCaseFile(source=self.SOURCE_HTML))
def test_creation(self):
for st in self.ctrl.settings:
assert_true(st is not None)
assert_equals(len(self.ctrl.settings), 9)
assert_false(self.ctrl.dirty)
def test_has_format(self):
assert_true(self.ctrl.has_format())
def test_get_format(self):
assert_equals(self.ctrl.get_format(), "html")
def test_source(self):
assert_equals(self.ctrl.filename, self.SOURCE_HTML)
def test_longname(self):
assert_equals(self.ctrl.longname, "Test.Cases")
self.ctrl.parent = lambda: 0
self.ctrl.parent.longname = "Parent"
assert_equals(self.ctrl.longname, "Parent.Test.Cases")
def test_set_format(self):
self.ctrl.set_format("txt")
assert_equals(self.ctrl.filename, self.SOURCE_TXT)
def test_add_test_or_kw(self):
assert_equals(len(self.ctrl.tests), 0)
new_test = TestCaseController(self.ctrl, TestCase(TestCaseFile(), "New test"))
self.ctrl.add_test_or_keyword(new_test)
assert_equals(len(self.ctrl.tests), 1)
assert_true(self.ctrl.tests[0]._test.parent.parent is self.ctrl.datafile)
assert_true(self.ctrl.dirty)
def test_new_test(self):
test_ctrl = self.ctrl.create_test("Foo")
assert_equals(test_ctrl.name, "Foo")
def test_create_keyword(self):
kw_ctrl = self.ctrl.create_keyword("An UK")
assert_equals(kw_ctrl.name, "An UK")
def test_create_keyword_with_args(self):
kw_ctrl = self.ctrl.create_keyword("UK", "${a1} | ${a2}")
assert_equals(kw_ctrl.name, "UK")
assert_equals(kw_ctrl.data.args.value, ["${a1}", "${a2}"])
开发者ID:abrain,项目名称:RIDE,代码行数:52,代码来源:test_filecontrollers.py
示例11: TestCaseCreationTest
class TestCaseCreationTest(unittest.TestCase):
def setUp(self):
self.ctrl = TestCaseFileController(TestCaseFile()).tests
def test_whitespace_is_stripped(self):
test = self.ctrl.new(' ' + VALID_NAME + '\t \n')
assert_equals(test.name, VALID_NAME)
开发者ID:Garjy,项目名称:RIDE,代码行数:8,代码来源:test_tablecontrollers.py
示例12: setUp
def setUp(self):
class Data(object):
source = directory = None
self.ctrl = TestCaseFileController(Data())
self._has_unsaved_changes = False
self._saved = False
self.messages = [(self._changes, RideDataChangedToDirty),
(self._cleared, RideDataDirtyCleared)]
for listener, topic in self.messages:
PUBLISHER.subscribe(listener, topic)
开发者ID:Garjy,项目名称:RIDE,代码行数:10,代码来源:test_filecontrollers.py
示例13: test_mtime
def test_mtime(self):
ctrl = TestCaseFileController(TestCaseFile(source=self._filepath).populate())
assert_false(ctrl.has_been_modified_on_disk())
os.utime(self._filepath, (1,1))
assert_true(ctrl.has_been_modified_on_disk())
开发者ID:Hariprasad-ka,项目名称:RIDE,代码行数:5,代码来源:test_modifications_on_disk.py
示例14: TestMarkUnMarkDirty
class TestMarkUnMarkDirty(unittest.TestCase):
def setUp(self):
class Data(object):
source = directory = None
self.ctrl = TestCaseFileController(Data())
self._has_unsaved_changes = False
self._saved = False
self.messages = [(self._changes, RideDataChangedToDirty),
(self._cleared, RideDataDirtyCleared)]
for listener, topic in self.messages:
PUBLISHER.subscribe(listener, topic)
def tearDown(self):
for listener, topic in self.messages:
PUBLISHER.unsubscribe(listener, topic)
if os.path.exists('path'):
shutil.rmtree('path')
def _changes(self, payload):
self._has_unsaved_changes = payload.datafile
def _cleared(self, payload):
self._saved = payload.datafile
def test_marking_data_dirty_publishes_data_has_changes_message(self):
self.ctrl.mark_dirty()
assert_equals(self._has_unsaved_changes, self.ctrl)
def test_clearing_dirty_mark_publishes_data_saved_message(self):
self.ctrl.mark_dirty()
self.ctrl.unmark_dirty()
assert_equals(self._saved, self.ctrl)
def test_remarking_data_dirty_does_not_publish_data_has_changes_message(self):
self.ctrl.mark_dirty()
self._has_unsaved_changes = None
self.ctrl.mark_dirty()
assert_equals(self._has_unsaved_changes, None)
def test_reclearing_dirty_mark_does_not_publish_data_saved_message(self):
self.ctrl.unmark_dirty()
self._saved = None
self.ctrl.unmark_dirty()
assert_equals(self._saved, None)
开发者ID:Garjy,项目名称:RIDE,代码行数:45,代码来源:test_filecontrollers.py
示例15: setUp
def setUp(self):
self.tcf = TestCaseFile()
filectrl = TestCaseFileController(self.tcf)
filectrl.resource_import_modified = Mock()
self.ctrl = ImportSettingsController(filectrl, self.tcf.setting_table)
开发者ID:EnochManohar,项目名称:RIDE,代码行数:5,代码来源:test_controllers.py
示例16: setUp
def setUp(self):
self.ctrl = TestCaseFileController(TestCaseFile()).tests
开发者ID:Garjy,项目名称:RIDE,代码行数:2,代码来源:test_tablecontrollers.py
示例17: test_finding_testcase_controller
def test_finding_testcase_controller(self):
suite_controller = TestCaseFileController(_testcasefile('Suite.txt'))
test = suite_controller.create_test('Test 1')
self.project._controller = suite_controller
result = self.project.find_controller_by_longname('Suite.Test 1', 'Test 1')
assert_equals(result, test)
开发者ID:Hariprasad-ka,项目名称:RIDE,代码行数:6,代码来源:test_chiefcontroller.py
示例18: test_size_change
def test_size_change(self):
os.utime(self._filepath, None)
ctrl = TestCaseFileController(TestCaseFile(source=self._filepath).populate())
open(self._filepath, 'a').write('#Ninja edit\n')
assert_true(ctrl.has_been_modified_on_disk())
开发者ID:Hariprasad-ka,项目名称:RIDE,代码行数:5,代码来源:test_modifications_on_disk.py
注:本文中的robotide.controller.filecontrollers.TestCaseFileController类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论