コード例 #1
0
ファイル: test_messages.py プロジェクト: Hariprasad-ka/RIDE
 def test_unsubscribe_with_class(self):
     listener_count = len(PUBLISHER._listeners[self.plugin])
     self.plugin.unsubscribe(self.plugin.OnTestEventClass, RideTestMessage)
     RideTestMessage().publish()
     assert_none(self.plugin.class_handler_topic)
     assert_equals(
         len(PUBLISHER._listeners[self.plugin]), listener_count - 1)
コード例 #2
0
 def test_end_suite_restores_previous_instance_with_one_suite(self):
     self.lib.start_test()
     self.lib.get_instance()
     self.lib.end_test()
     self.lib.get_instance()
     self.lib.end_suite()
     assert_none(self.lib._libinst)
コード例 #3
0
 def test_unsubscribe_with_class(self):
     listener_count = len(PUBLISHER._listeners[self.plugin])
     self.plugin.unsubscribe(self.plugin.OnTestEventClass, RideTestMessage)
     RideTestMessage().publish()
     assert_none(self.plugin.class_handler_topic)
     assert_equals(len(PUBLISHER._listeners[self.plugin]),
                   listener_count - 1)
コード例 #4
0
 def test_cache_expiration(self):
     cache = ExpiringCache(0.01)
     cache.put('a', 'b')
     time.sleep(0.1)
     assert_none(cache.get('a'))
     cache.put('a', 'c')
     assert_equals('c', cache.get('a'))
コード例 #5
0
 def test_get_set_del_non_ascii_vars(self):
     set_env_var(NON_ASCII_VAR, NON_ASCII_VAL)
     for k, v in os.environ.items():
         assert_true(isinstance(k, str) and isinstance(v, str))
     assert_equals(get_env_var(NON_ASCII_VAR), NON_ASCII_VAL)
     assert_equals(del_env_var(NON_ASCII_VAR), NON_ASCII_VAL)
     assert_none(get_env_var(NON_ASCII_VAR))
コード例 #6
0
 def test_non_global_dynamic_handlers(self):
     lib = TestLibrary("RunKeywordLibrary")
     assert_equal(len(lib.handlers), 2)
     assert_true('Run Keyword That Passes' in lib.handlers)
     assert_true('Run Keyword That Fails' in lib.handlers)
     assert_none(lib.handlers['Run Keyword That Passes']._method)
     assert_none(lib.handlers['Run Keyword That Fails']._method)
コード例 #7
0
 def _verify_import_reference_is_not_resolved(self):
     imported_controller = self.import_setting.get_imported_controller()
     if imported_controller:
         msg = 'Resolved to source %s' % imported_controller.source
     else:
         msg = None
     assert_none(imported_controller, msg)
コード例 #8
0
 def test_cache_expiration(self):
     cache = ExpiringCache(0.01)
     cache.put('a', 'b')
     time.sleep(0.1)
     assert_none(cache.get('a'))
     cache.put('a', 'c')
     assert_equals('c', cache.get('a'))
コード例 #9
0
 def _get_lib_and_instance(self, name):
     lib = TestLibrary(name)
     if lib.scope.is_global:
         assert_not_none(lib._libinst)
     else:
         assert_none(lib._libinst)
     return lib, lib._libinst
コード例 #10
0
ファイル: test_model.py プロジェクト: zwunix/robotframework
 def test_init(self):
     assert_none(self.tcf.source)
     assert_true(
         isinstance(self.tcf.setting_table, TestCaseFileSettingTable))
     assert_true(isinstance(self.tcf.variable_table, VariableTable))
     assert_true(isinstance(self.tcf.testcase_table, TestCaseTable))
     assert_true(isinstance(self.tcf.keyword_table, KeywordTable))
コード例 #11
0
 def test_get_set_del_non_ascii_vars(self):
     set_env_var(NON_ASCII_VAR, NON_ASCII_VAL)
     for k, v in os.environ.items():
         assert_true(isinstance(k, str) and isinstance(v, str))
     assert_equals(get_env_var(NON_ASCII_VAR), NON_ASCII_VAL)
     assert_equals(del_env_var(NON_ASCII_VAR), NON_ASCII_VAL)
     assert_none(get_env_var(NON_ASCII_VAR))
コード例 #12
0
 def _verify_import_reference_is_not_resolved(self):
     imported_controller = self.import_setting.get_imported_controller()
     if imported_controller:
         msg = 'Resolved to source %s' % imported_controller.source
     else:
         msg = None
     assert_none(imported_controller, msg)
コード例 #13
0
 def test_valid_arguments_validation(self):
     for arg in [
             "${arg}", "${arg}|${arg2}", "${arg}=", "${arg}=default val",
             "${a} | ${b}=d | ${c}=\\| | ${d}=", "@{list}",
             "${a} | ${b} | ${c}=1 | ${d}=2 | ${e}=3 | @{f}"
     ]:
         assert_none(self.validate(arg))
コード例 #14
0
 def test_setup_is_removed_when_set_to_none(self):
     kw = Keyword()
     kws = Keywords(keywords=[Keyword(type='setup'), kw])
     kws.setup = None
     assert_none(kws.setup)
     assert_equal(list(kws), [kw])
     kws.setup = None
     assert_none(kws.setup)
     assert_equal(list(kws), [kw])
コード例 #15
0
 def test_teardown_is_removed_when_set_to_none(self):
     kw = Keyword()
     kws = Keywords(keywords=[kw, Keyword(type='teardown')])
     kws.teardown = None
     assert_none(kws.teardown)
     assert_equal(list(kws), [kw])
     kws.teardown = None
     assert_none(kws.teardown)
     assert_equal(list(kws), [kw])
コード例 #16
0
 def test_setup_is_removed_when_set_to_none(self):
     kw = Keyword()
     kws = Keywords(keywords=[Keyword(type='setup'), kw])
     kws.setup = None
     assert_none(kws.setup)
     assert_equal(list(kws), [kw])
     kws.setup = None
     assert_none(kws.setup)
     assert_equal(list(kws), [kw])
コード例 #17
0
 def test_teardown_is_removed_when_set_to_none(self):
     kw = Keyword()
     kws = Keywords(keywords=[kw, Keyword(type='teardown')])
     kws.teardown = None
     assert_none(kws.teardown)
     assert_equal(list(kws), [kw])
     kws.teardown = None
     assert_none(kws.teardown)
     assert_equal(list(kws), [kw])
コード例 #18
0
 def _run_tests(self, suite_inst, count=3):
     old_insts = [suite_inst]
     for _ in range(count):
         self.lib.start_test()
         assert_none(self.lib._libinst)
         inst = self.lib.get_instance()
         assert_false(inst in old_insts)
         old_insts.append(inst)
         self.lib.end_test()
         assert_true(self.lib._libinst is suite_inst)
コード例 #19
0
 def test_valid_arguments_validation(self):
     for arg in [
         "${arg}",
         "${arg}|${arg2}",
         "${arg}=",
         "${arg}=def val",
         "${a} | ${b}=d | ${c}=\\| | ${d}=",
         "@{list}",
         "${a} | ${b} | ${c}=1 | ${d}=2 | ${e}=3 | @{f}",
     ]:
         assert_none(self.validate(arg))
コード例 #20
0
ファイル: test_model.py プロジェクト: zwunix/robotframework
 def test_name(self):
     assert_none(self.tcf.name)
     for source, name in [('hello.txt', 'Hello'), ('hello', 'Hello'),
                          ('hello_world.tsv', 'Hello World'),
                          ('HELLO_world.htm', 'HELLO world'),
                          ('1name', '1Name'),
                          ('  h i   w o r l d  .htm', 'H I   W O R L D'),
                          ('HelloWorld.txt', 'HelloWorld'),
                          ('09__h_E_l_l_o_', 'h E l l o'),
                          ('prefix__the__name', 'The  Name')]:
         self.tcf.source = os.path.abspath(source)
         assert_equal(self.tcf.name, name)
コード例 #21
0
 def test_name(self):
     assert_none(self.tcf.name)
     for source, name in [('hello.txt', 'Hello'),
                          ('hello', 'Hello'),
                          ('hello_world.tsv', 'Hello World'),
                          ('HELLO_world.htm', 'HELLO world'),
                          ('1name', '1Name'),
                          ('  h i   w o r l d  .htm', 'H I   W O R L D'),
                          ('HelloWorld.txt', 'HelloWorld'),
                          ('09__h_E_l_l_o_', 'h E l l o'),
                          ('prefix__the__name', 'The  Name')]:
         self.tcf.source = os.path.abspath(source)
         assert_equal(self.tcf.name, name)
コード例 #22
0
def check_quick_inv_match_obj_from_quick_inv_task(quick_inv_task, agent,
                                                  no_rca):
    match_agent = TbQuickInvMatchObjectInfo.find_by_slf_key_and_agent(
        quick_inv_task.SLF_Key, agent)
    assert_not_none(match_agent, "agent %s should exist" % agent)
    assert_equal(match_agent.RetroScanData_MD5,
                 quick_inv_task.RetroScanData_MD5,
                 "RetroScanData_MD5 should be the same")
    assert_equal(match_agent.RetroScanCategory,
                 quick_inv_task.RetroScanCategory,
                 "RetroScanCategory should be the same")
    if no_rca:
        assert_none(
            match_agent.RCAScanID,
            "RCAScanID should be NULL when RCA return no affected or yet to run RCA"
        )
コード例 #23
0
def check_init_rca_result(criteria, criteria_type, agents):
    agents = agents.split(',')
    for index in range(0, len(agents)):
        rca_agent = TbRCATask.find_by_criteria_and_agent(
            criteria, agents[index])
        assert_not_none(rca_agent,
                        "RCA record for agent %s should exist" % agents[index])
        assert_equal(rca_agent.CriteriaType, int(criteria_type),
                     "RCA criteriaType should be %s" % criteria_type)
        assert_none(rca_agent.TaskID, "RCA TaskID should not be NULL")
        assert_none(rca_agent.ScanSummaryID,
                    "RCA ScanSummaryID should not be NULL")
        assert_equal(rca_agent.Status, 0,
                     "RCA status should be 0 for init value")
        assert_equal(rca_agent.IsAffected, 0,
                     "RCA IsAffected should be 0 for init value")
        assert_equal(rca_agent.IsSync, 0,
                     "RCA IsSync should be 0 for init value")
コード例 #24
0
 def test_given_when_then_and_aliases(self):
     assert_not_none(
         self.ns.find_user_keyword(
             self.tcf,
             '  Given   UK Fromresource from rESOURCE with variaBLE'))
     assert_not_none(
         self.ns.find_user_keyword(
             self.tcf, 'when  UK Fromresource from rESOURCE with variaBLE'))
     assert_not_none(
         self.ns.find_user_keyword(
             self.tcf,
             '  then UK Fromresource from rESOURCE with variaBLE'))
     assert_not_none(
         self.ns.find_user_keyword(
             self.tcf, 'AND UK Fromresource from rESOURCE with variaBLE'))
     assert_none(
         self.ns.find_user_keyword(
             self.tcf,
             'given and UK Fromresource from rESOURCE with variaBLE'))
コード例 #25
0
 def test_unsubscribe_all(self):
     self.plugin.unsubscribe_all()
     self._unsubscribe_all = False
     RideTestMessage().publish()
     RideMessageWithData(data_item='Data', more_data=[1, 2, 3]).publish()
     assert_none(self.plugin.class_handler_topic)
     assert_none(self.plugin.string_handler_topic)
     assert_none(self.plugin.case_insensitive_string_handler_topic)
     assert_equals(self.plugin.record, {})
     assert_equals(self.plugin.count, 0)
     assert_equals(self.plugin.hierarchy_events, [])
     assert_false(self.plugin in PUBLISHER._listeners)
コード例 #26
0
ファイル: test_messages.py プロジェクト: Acidburn0zzz/RIDE
 def test_unsubscribe_all(self):
     self.plugin.unsubscribe_all()
     self._unsubscribe_all = False
     RideTestMessage().publish()
     RideMessageWithData(data_item='Data', more_data=[1,2,3]).publish()
     assert_none(self.plugin.class_handler_topic)
     assert_none(self.plugin.string_handler_topic)
     assert_none(self.plugin.case_insensitive_string_handler_topic)
     assert_equals(self.plugin.record, {})
     assert_equals(self.plugin.count, 0)
     assert_equals(self.plugin.hierarchy_events, [])
     assert_false(self.plugin in PUBLISHER._listeners)
コード例 #27
0
 def test_name_from_test_case_file(self):
     assert_none(self._get_userlibrary().name)
コード例 #28
0
 def test_get_set_del_non_ascii_vars(self):
     set_env_var(NON_ASCII_VAR, NON_ASCII_VAL)
     assert_equal(get_env_var(NON_ASCII_VAR), NON_ASCII_VAL)
     assert_equal(del_env_var(NON_ASCII_VAR), NON_ASCII_VAL)
     assert_none(get_env_var(NON_ASCII_VAR))
コード例 #29
0
 def test_get_env_var(self):
     assert_not_none(get_env_var('PATH'))
     assert_equal(get_env_var(TEST_VAR), TEST_VAL)
     assert_none(get_env_var('NoNeXiStInG'))
     assert_equal(get_env_var('NoNeXiStInG', 'default'), 'default')
コード例 #30
0
ファイル: test_messages.py プロジェクト: Acidburn0zzz/RIDE
 def test_unsubscribe_with_string(self):
     self.plugin.unsubscribe(self.plugin.OnTestEventString, 'ride.test')
     RideTestMessage().publish()
     assert_none(self.plugin.string_handler_topic)
コード例 #31
0
ファイル: test_namespace.py プロジェクト: pskpg86/RIDE
 def test_file_with_invalid_path(self):
     imp = Resource(ParentMock(), '${kumikameli}')
     assert_none(self._res_cache.get_resource(imp.directory, imp.name))
コード例 #32
0
ファイル: test_namespace.py プロジェクト: pskpg86/RIDE
 def test_find_user_keyword_name_normalized(self):
     assert_not_none(self.ns.find_user_keyword(self.tcf, 'UK Fromresource from rESOURCE with variaBLE'))
     assert_none(self.ns.find_user_keyword(self.tcf, 'Copy List'))
コード例 #33
0
 def test_find_user_keyword_name_normalized(self):
     assert_not_none(
         self.ns.find_user_keyword(
             self.tcf, 'UK Fromresource from rESOURCE with variaBLE'))
     assert_none(self.ns.find_user_keyword(self.tcf, 'Copy List'))
コード例 #34
0
 def test_unsubscribe_with_string_is_case_insensitive(self):
     self.plugin.unsubscribe(self.plugin.OnTestEventStringWrongCase,
                             'RiDe.TEst')
     RideTestMessage().publish()
     assert_none(self.plugin.case_insensitive_string_handler_topic)
コード例 #35
0
 def test_unsubscribe_with_string(self):
     self.plugin.unsubscribe(self.plugin.OnTestEventString, 'ride.test')
     RideTestMessage().publish()
     assert_none(self.plugin.string_handler_topic)
コード例 #36
0
 def test_get_env_var(self):
     assert_not_none(get_env_var("PATH"))
     assert_equals(get_env_var(TEST_VAR), TEST_VAL)
     assert_none(get_env_var("NoNeXiStInG"))
     assert_equals(get_env_var("NoNeXiStInG", "default"), "default")
コード例 #37
0
 def test_creating_separator(self):
     item = PopupMenuItem('---')
     assert_equals(item.name, '---')
     assert_none(item.callable)
コード例 #38
0
 def test_file_with_invalid_path(self):
     imp = Resource(ParentMock(), '${kumikameli}')
     assert_none(self._res_cache.get_resource(imp.directory, imp.name))
コード例 #39
0
 def test_loading_invalid_resource(self):
     assert_none(self.ctrl.load_resource('invalid', self.load_observer))
     assert_equals(self.load_observer.message, "Invalid resource file 'invalid'.")
     self._test_listeners([], [])
コード例 #40
0
 def test_assert_none(self):
     assert_none(None)
     assert_raises_with_msg(AE, "message: 'Not None' is not None",
                            assert_none, 'Not None', 'message')
     assert_raises_with_msg(AE, "message",
                            assert_none, 'Not None', 'message', False)
コード例 #41
0
 def test_name_from_test_case_file(self):
     assert_none(self._get_userlibrary('NOT_RESOURCE').name)
コード例 #42
0
ファイル: test_menu.py プロジェクト: Acidburn0zzz/RIDE
 def test_get_registered_name(self):
     self._test('&File', '&File')
     for name in 'F&ile', 'File', '&File', 'FI&LE', 'fil&e', 'file':
         assert_equals(self._nb.get_registered_name(name), '&File')
     assert_none(self._nb.get_registered_name('Non Existing'))
コード例 #43
0
ファイル: test_robotenv.py プロジェクト: nhutnb22/DieuAuto
 def test_get_env_var(self):
     assert_not_none(get_env_var('PATH'))
     assert_equal(get_env_var(TEST_VAR), TEST_VAL)
     assert_none(get_env_var('NoNeXiStInG'))
     assert_equal(get_env_var('NoNeXiStInG', 'default'), 'default')
コード例 #44
0
ファイル: test_namespace.py プロジェクト: pskpg86/RIDE
 def test_given_when_then_and_aliases(self):
     assert_not_none(self.ns.find_user_keyword(self.tcf, '  Given   UK Fromresource from rESOURCE with variaBLE'))
     assert_not_none(self.ns.find_user_keyword(self.tcf, 'when  UK Fromresource from rESOURCE with variaBLE'))
     assert_not_none(self.ns.find_user_keyword(self.tcf, '  then UK Fromresource from rESOURCE with variaBLE'))
     assert_not_none(self.ns.find_user_keyword(self.tcf, 'AND UK Fromresource from rESOURCE with variaBLE'))
     assert_none(self.ns.find_user_keyword(self.tcf, 'given and UK Fromresource from rESOURCE with variaBLE'))
コード例 #45
0
ファイル: test_robotenv.py プロジェクト: nhutnb22/DieuAuto
 def test_del_env_var(self):
     old = del_env_var(TEST_VAR)
     assert_none(os.getenv(TEST_VAR))
     assert_equal(old, TEST_VAL)
     assert_none(del_env_var(TEST_VAR))
コード例 #46
0
ファイル: test_robotenv.py プロジェクト: nhutnb22/DieuAuto
 def test_get_set_del_non_ascii_vars(self):
     set_env_var(NON_ASCII_VAR, NON_ASCII_VAL)
     assert_equal(get_env_var(NON_ASCII_VAR), NON_ASCII_VAL)
     assert_equal(del_env_var(NON_ASCII_VAR), NON_ASCII_VAL)
     assert_none(get_env_var(NON_ASCII_VAR))
コード例 #47
0
 def test_get_link_returns_none_when_no_match(self):
     link = TagStatLink('smoke', 'http://tobacco.com', 'Lung cancer')
     for tag in ['foo', 'b a r', 's moke']:
         assert_none(link.get_link(tag))
コード例 #48
0
ファイル: test_messages.py プロジェクト: Acidburn0zzz/RIDE
 def test_unsubscribe_with_string_is_case_insensitive(self):
     self.plugin.unsubscribe(self.plugin.OnTestEventStringWrongCase, 'RiDe.TEst')
     RideTestMessage().publish()
     assert_none(self.plugin.case_insensitive_string_handler_topic)
コード例 #49
0
 def test_get_setup(self):
     assert_none(Keywords().setup)
     setup = Keyword(type='setup')
     kws = Keywords(keywords=[setup, Keyword(), Keyword()])
     assert_true(kws.setup is setup)
コード例 #50
0
 def test_del_env_var(self):
     old = del_env_var(TEST_VAR)
     assert_none(os.getenv(TEST_VAR))
     assert_equal(old, TEST_VAL)
     assert_none(del_env_var(TEST_VAR))
コード例 #51
0
ファイル: test_format_change.py プロジェクト: nbbull/RIDE
 def _verify_import_reference_is_not_resolved(self):
     assert_none(self.import_setting.get_imported_controller())
コード例 #52
0
 def test_init(self):
     assert_none(self.tcf.source)
     assert_true(isinstance(self.tcf.setting_table, TestCaseFileSettingTable))
     assert_true(isinstance(self.tcf.variable_table, VariableTable))
     assert_true(isinstance(self.tcf.testcase_table, TestCaseTable))
     assert_true(isinstance(self.tcf.keyword_table, KeywordTable))
コード例 #53
0
ファイル: test_arguments.py プロジェクト: Acidburn0zzz/RIDE
 def test_invalid_argument(self):
     arg = parse_argument('${my invalid')
     assert_none(arg)
コード例 #54
0
 def test_get_link_returns_none_when_no_match(self):
     link = TagStatLink('smoke', 'http://tobacco.com', 'Lung cancer')
     for tag in ['foo', 'b a r', 's moke']:
         assert_none(link.get_link(tag))
コード例 #55
0
 def test_get_registered_name(self):
     self._test('&File', '&File')
     for name in 'F&ile', 'File', '&File', 'FI&LE', 'fil&e', 'file':
         assert_equals(self._nb.get_registered_name(name), '&File')
     assert_none(self._nb.get_registered_name('Non Existing'))
コード例 #56
0
 def test_name_from_test_case_file(self):
     assert_none(self._get_userlibrary().name)
コード例 #57
0
ファイル: test_cellinfo.py プロジェクト: Acidburn0zzz/RIDE
 def test_no_cell_info_if_no_data(self):
     assert_none(self.test.get_cell_info(0, 0))
     assert_none(self.test.get_cell_info(0, 1))
     assert_none(self.test.get_cell_info(0, 2))
     assert_none(self.test.get_cell_info(0, 3))
コード例 #58
0
ファイル: test_asserts.py プロジェクト: synsun/robotframework
 def test_assert_none(self):
     assert_none(None)
     assert_raises_with_msg(AE, "message: 'Not None' is not None",
                            assert_none, 'Not None', 'message')
     assert_raises_with_msg(AE, "message",
                            assert_none, 'Not None', 'message', False)
コード例 #59
0
ファイル: test_popupmenu.py プロジェクト: Hariprasad-ka/RIDE
 def test_creating_separator(self):
     item = PopupMenuItem('---')
     assert_equals(item.name, '---')
     assert_none(item.callable)