Beispiel #1
0
 def test_copy(self):
     test = self.test
     copy = test.copy()
     assert_equal(test.name, copy.name)
     copy.name += 'copy'
     assert_not_equal(test.name, copy.name)
     assert_equal(id(test.tags), id(copy.tags))
 def test_copy(self):
     kw = Keyword(name='Keyword')
     copy = kw.copy()
     assert_equal(kw.name, copy.name)
     copy.name += ' copy'
     assert_not_equal(kw.name, copy.name)
     assert_equal(id(kw.tags), id(copy.tags))
 def test_copy(self):
     test = self.test
     copy = test.copy()
     assert_equal(test.name, copy.name)
     copy.name += 'copy'
     assert_not_equal(test.name, copy.name)
     assert_equal(id(test.tags), id(copy.tags))
Beispiel #4
0
 def test_copy(self):
     kw = Keyword(name='Keyword')
     copy = kw.copy()
     assert_equal(kw.name, copy.name)
     copy.name += ' copy'
     assert_not_equal(kw.name, copy.name)
     assert_equal(id(kw.tags), id(copy.tags))
Beispiel #5
0
 def test_global_dynamic_handlers(self):
     lib = TestLibrary("RunKeywordLibrary.GlobalRunKeywordLibrary")
     assert_equal(len(lib.handlers), 2)
     for name in 'Run Keyword That Passes', 'Run Keyword That Fails':
         handler = lib.handlers[name]
         assert_not_none(handler._method)
         assert_not_equal(handler._method, lib._libinst.run_keyword)
         assert_equal(handler._method.__name__, 'handler')
Beispiel #6
0
 def test_test_case_copy(self):
     test = self._create_test()
     copied = test.copy('Copied')
     assert_equal(copied.name, 'Copied')
     assert_equal(copied.tags.value, test.tags.value)
     assert_not_equal(copied.steps[0], test.steps[0])
     test.add_step(['A new KW'])
     assert_not_equal(len(test.steps), len(copied.steps))
 def test_test_case_copy(self):
     test = self._create_test()
     copied = test.copy('Copied')
     assert_equal(copied.name, 'Copied')
     assert_equal(copied.tags.value, test.tags.value)
     assert_not_equal(copied.steps[0], test.steps[0])
     test.add_step(['A new KW'])
     assert_not_equal(len(test.steps), len(copied.steps))
Beispiel #8
0
 def test_assert_not_equal_with_custom_formatter(self):
     assert_not_equal('hyv\xe4', 'paha', formatter=repr)
     assert_raises_with_msg(AE,
                            "'\xe4' == '\xe4'",
                            assert_not_equal,
                            '\xe4',
                            '\xe4',
                            formatter=repr)
Beispiel #9
0
 def assert_same_attrs_and_different_values(self, model1, model2):
     assert_equal(dir(model1), dir(model2))
     for attr, value1, value2 in self.get_non_property_attrs(model1, model2):
         if attr.startswith('__') or self.cannot_differ(value1, value2):
             continue
         assert_not_equal(id(value1), id(value2), attr)
         if isinstance(value1, ModelObject):
             self.assert_same_attrs_and_different_values(value1, value2)
 def assert_same_attrs_and_different_values(self, model1, model2):
     assert_equal(dir(model1), dir(model2))
     for attr, value1, value2 in self.get_non_property_attrs(model1, model2):
         if attr.startswith('__') or self.cannot_differ(value1, value2):
             continue
         assert_not_equal(id(value1), id(value2), attr)
         if isinstance(value1, ModelObject):
             self.assert_same_attrs_and_different_values(value1, value2)
Beispiel #11
0
 def test_assert_not_equal_with_custom_formatter(self):
     assert_not_equal(u'hyv\xe4', u'paha', formatter=repr)
     expected = "u'\\xe4' == u'\\xe4'" if PY2 else "'\xe4' == '\xe4'"
     assert_raises_with_msg(AE,
                            expected,
                            assert_not_equal,
                            u'\xe4',
                            u'\xe4',
                            formatter=repr)
Beispiel #12
0
def audit_should_be(event_type_id,
                    expected_count,
                    expected_description,
                    expected_result=1):
    config = ConfigHelper()
    records = TbUserAccessLog.find_records_by_event_type(event_type_id)
    assert_equal(len(records), int(expected_count))
    for r in records:
        assert_equal(r.UserID, config.get_data_from_config('CM', 'app_name'))
        assert_equal(r.Result, int(expected_result))
        assert_not_equal(re.match(expected_description, r.Description), None)
 def test_order_does_not_affect_equality(self):
     d = dict(a=1, b=2, c=3, d=4, e=5, f=6, g=7)
     od1 = OrderedDict(sorted(d.items()))
     od2 = OrderedDict(reversed(list(od1.items())))
     dd1 = DotDict(sorted(d.items()))
     dd2 = DotDict(reversed(list(dd1.items())))
     for d1, d2 in [(dd1, dd2), (dd1, d), (dd2, d), (dd1, od1), (dd2, od2)]:
         assert_equal(d1, d2)
         assert_equal(d2, d1)
     if not IRONPYTHON:
         # https://github.com/IronLanguages/main/issues/1168
         for d1, d2 in [(dd1, od2), (dd2, od1)]:
             assert_equal(d1, d2)
             assert_equal(d2, d1)
     assert_not_equal(od1, od2)
Beispiel #14
0
 def test_order_does_not_affect_equality(self):
     d = dict(a=1, b=2, c=3, d=4, e=5, f=6, g=7)
     od1 = OrderedDict(sorted(d.items()))
     od2 = OrderedDict(reversed(list(od1.items())))
     dd1 = DotDict(sorted(d.items()))
     dd2 = DotDict(reversed(list(dd1.items())))
     for d1, d2 in [(dd1, dd2), (dd1, d), (dd2, d), (dd1, od1), (dd2, od2)]:
         assert_equal(d1, d2)
         assert_equal(d2, d1)
     if not IRONPYTHON:
         # https://github.com/IronLanguages/main/issues/1168
         for d1, d2 in [(dd1, od2), (dd2, od1)]:
             assert_equal(d1, d2)
             assert_equal(d2, d1)
     assert_not_equal(od1, od2)
 def test_assert_not_equal(self):
     assert_not_equal("abc", "ABC")
     assert_not_equal(42, -42, "hello", True)
     assert_not_equal(MyEqual("cat"), MyEqual("dog"))
     assert_not_equal(None, True)
     raise_msg = assert_raises_with_msg  # shorter to use here
     raise_msg(AE, "str == str", assert_not_equal, "str", "str")
     raise_msg(AE, "hello: 42 == 42", assert_not_equal, 42, 42, "hello")
     raise_msg(AE, "hello", assert_not_equal, MyEqual("cat"), MyEqual("cat"), "hello", False)
 def test_assert_not_equal(self):
     assert_not_equal('abc', 'ABC')
     assert_not_equal(42, -42, 'hello', True)
     assert_not_equal(MyEqual('cat'), MyEqual('dog'))
     assert_not_equal(None, True)
     raise_msg = assert_raises_with_msg  # shorter to use here
     raise_msg(AE, "str == str", assert_not_equal, 'str', 'str')
     raise_msg(AE, "hello: 42 == 42", assert_not_equal, 42, 42, 'hello')
     raise_msg(AE, "hello", assert_not_equal, MyEqual('cat'), MyEqual('cat'),
               'hello', False)
Beispiel #17
0
 def test_assert_not_equal(self):
     assert_not_equal('abc', 'ABC')
     assert_not_equal(42, -42, 'hello', True)
     assert_not_equal(MyEqual('cat'), MyEqual('dog'))
     assert_not_equal(None, True)
     raise_msg = assert_raises_with_msg  # shorter to use here
     raise_msg(AE, "str == str", assert_not_equal, 'str', 'str')
     raise_msg(AE, "hello: 42 == 42", assert_not_equal, 42, 42, 'hello')
     raise_msg(AE, "hello", assert_not_equal, MyEqual('cat'), MyEqual('cat'),
               'hello', False)
 def assert_deepcopy(self, original, copied):
     assert_not_equal(id(original), id(copied))
     self.assert_same_attrs_and_different_values(original, copied)
 def assert_copy(self, original, copied):
     assert_not_equal(id(original), id(copied))
     self.assert_same_attrs_and_values(original, copied)
     for attr in ['suites', 'tests', 'keywords']:
         for child in getattr(original, attr, []):
             self.assert_copy(child, child.copy())
 def test_suite_keyword(self):
     kw = TestSuite().keywords.create()
     assert_equal(type(kw), Keyword)
     assert_not_equal(type(kw), model.Keyword)
Beispiel #21
0
 def test_suite_setup(self):
     suite = TestSuite()
     assert_equal(type(suite.setup), Keyword)
     assert_equal(type(suite.teardown), Keyword)
     assert_not_equal(type(suite.setup), model.Keyword)
     assert_not_equal(type(suite.teardown), model.Keyword)
 def test_suite_test_case(self):
     test = TestSuite().tests.create()
     assert_equal(type(test), TestCase)
     assert_not_equal(type(test), model.TestCase)
 def test_deepcopy_(self):
     test = self.test
     copy = test.deepcopy()
     assert_equal(test.name, copy.name)
     assert_not_equal(id(test.tags), id(copy.tags))
 def test_test_case_keyword(self):
     kw = TestCase().keywords.create()
     assert_equal(type(kw), Keyword)
     assert_not_equal(type(kw), model.Keyword)
Beispiel #25
0
 def test_deepcopy_(self):
     test = self.test
     copy = test.deepcopy()
     assert_equal(test.name, copy.name)
     assert_not_equal(id(test.tags), id(copy.tags))
 def test_assert_not_equal_with_custom_formatter(self):
     assert_not_equal(u'hyv\xe4', u'paha', formatter=repr)
     expected = "u'\\xe4' == u'\\xe4'" if PY2 else "'\xe4' == '\xe4'"
     assert_raises_with_msg(AE, expected,
                            assert_not_equal, u'\xe4', u'\xe4',
                            formatter=repr)
 def test_test_case_keyword(self):
     kw = TestCase().keywords.create()
     assert_equal(type(kw), Keyword)
     assert_not_equal(type(kw), model.Keyword)
 def test_suite_keyword(self):
     kw = TestSuite().keywords.create()
     assert_equal(type(kw), Keyword)
     assert_not_equal(type(kw), model.Keyword)
 def assert_copy(self, original, copied):
     assert_not_equal(id(original), id(copied))
     self.assert_same_attrs_and_values(original, copied)
     for attr in ['suites', 'tests', 'keywords']:
         for child in getattr(original, attr, []):
             self.assert_copy(child, child.copy())
Beispiel #30
0
 def test__eq__converts_other_to_tags(self):
     assert_equal(Tags(['X']), ['x'])
     assert_equal(Tags(['X']), 'x')
     assert_not_equal(Tags(['X']), 'y')
 def assert_deepcopy(self, original, copied):
     assert_not_equal(id(original), id(copied))
     self.assert_same_attrs_and_different_values(original, copied)
 def test_suite_test_case(self):
     test = TestSuite().tests.create()
     assert_equal(type(test), TestCase)
     assert_not_equal(type(test), model.TestCase)
 def _assert_randomized(self, items):
     assert_not_equal([i.name for i in items], self.names)
 def _assert_randomized(self, items):
     assert_not_equal([i.name for i in items], self.names)
 def validateFailStatus(self, statusCode):
     return assert_not_equal(statusCode, 201)
Beispiel #36
0
 def test__eq__(self):
     assert_equal(Tags(['x']), Tags(['x']))
     assert_equal(Tags(['X']), Tags(['x']))
     assert_equal(Tags(['X']), Tags(('x', )))
     assert_not_equal(Tags(['X']), ['x'])
     assert_not_equal(Tags(['X']), ('x', ))
Beispiel #37
0
 def test__eq__(self):
     assert_equal(Tags(['x']), Tags(['x']))
     assert_equal(Tags(['X']), Tags(['x']))
     assert_equal(Tags(['X', 'YZ']), Tags(('x', 'y_z')))
     assert_not_equal(Tags(['X']), Tags(['Y']))