Пример #1
0
class TestKeywordTable(unittest.TestCase):

    def setUp(self):
        self.table = TestCaseFile().keyword_table
        self.kw = UserKeyword(None, 'name')

    def test_init(self):
        assert_equal(self.table.keywords, [])

    def test_add_keyword(self):
        kw = self.table.add('My name')
        assert_true(len(self.table.keywords), 1)
        assert_true(self.table.keywords[0] is kw)
        assert_equal(kw.name, 'My name')

    def test_settings(self):
        assert_true(isinstance(self.kw.doc, Documentation))
        assert_true(isinstance(self.kw.args, Arguments))
        assert_true(isinstance(self.kw.return_, Return))
        assert_true(isinstance(self.kw.timeout, Timeout))
        assert_true(isinstance(self.kw.teardown, Fixture))

    def test_set_settings(self):
        self.kw.doc.populate('My coooool doc')
        self.kw.args.populate(['${args}', 'are not', 'validated'])
        assert_equal(self.kw.doc.value, 'My coooool doc')
        assert_equal(self.kw.args.value, ['${args}', 'are not', 'validated'])

    def test_add_step(self):
        step = self.kw.add_step(['Keyword', 'arg1', 'arg2'])
        assert_equal(self.kw.steps, [step])
        assert_equal(step.name, 'Keyword')
        assert_equal(step.args, ['arg1', 'arg2'])

    def test_add_for_loop(self):
        loop = self.kw.add_for_loop(['${var}', 'IN', 'value'])
        assert_equal(self.kw.steps, [loop])

    def test_old_style_headers_are_ignored(self):
        self.table.set_header(['keywords', 'Action', 'Arg', 'Argument'])
        assert_equal(self.table.header, ['keywords'])

    def test_len(self):
        self.table.set_header(['Keywords'])
        assert_equal(len(self.table), 0)
        self.table.add('A kw')
        self.table.add('B keyword')
        assert_equal(len(self.table), 2)
Пример #2
0
class TestKeywordTable(unittest.TestCase):

    def setUp(self):
        self.table = TestCaseFile().keyword_table
        self.kw = UserKeyword(None, 'name')

    def test_init(self):
        assert_equal(self.table.keywords, [])

    def test_add_keyword(self):
        kw = self.table.add('My name')
        assert_true(len(self.table.keywords), 1)
        assert_true(self.table.keywords[0] is kw)
        assert_equal(kw.name, 'My name')

    def test_settings(self):
        assert_true(isinstance(self.kw.doc, Documentation))
        assert_true(isinstance(self.kw.args, Arguments))
        assert_true(isinstance(self.kw.return_, Return))
        assert_true(isinstance(self.kw.timeout, Timeout))
        assert_true(isinstance(self.kw.teardown, Fixture))

    def test_set_settings(self):
        self.kw.doc.populate('My coooool doc')
        self.kw.args.populate(['${args}', 'are not', 'validated'])
        assert_equal(self.kw.doc.value, 'My coooool doc')
        assert_equal(self.kw.args.value, ['${args}', 'are not', 'validated'])

    def test_add_step(self):
        step = self.kw.add_step(['Keyword', 'arg1', 'arg2'])
        assert_equal(self.kw.steps, [step])
        assert_equal(step.name, 'Keyword')
        assert_equal(step.args, ['arg1', 'arg2'])

    def test_add_for_loop(self):
        loop = self.kw.add_for_loop(['${var}', 'IN', 'value'])
        assert_equal(self.kw.steps, [loop])

    def test_old_style_headers_are_ignored(self):
        self.table.set_header(['keywords', 'Action', 'Arg', 'Argument'])
        assert_equal(self.table.header, ['keywords'])

    def test_len(self):
        self.table.set_header(['Keywords'])
        assert_equal(len(self.table), 0)
        self.table.add('A kw')
        self.table.add('B keyword')
        assert_equal(len(self.table), 2)
 def test_uk_arguments_parsing(self):
     uk = UserKeyword(_FakeTestCaseFile(), 'My User keyword')
     uk.args.value = ['${arg1}', '${arg2}=def', '@{varargs}']
     kw_info = TestCaseUserKeywordInfo(uk)
     exp_source = 'testcase.txt'
     exp_args = '[ arg1 | arg2=def | *varargs ]'
     assert_in_details(kw_info, exp_source, exp_args)
Пример #4
0
 def _get_userlibrary(self, *keyword_names):
     return UserLibrary([UserKeyword(None, name) for name in keyword_names],
                        'source', UserLibrary.TEST_CASE_FILE_TYPE)
 def test_resource_uk_longname(self):
     uk = UserKeyword(KeywordTable(_FakeResourceFile()), 'UK')
     kw_info = ResourceUserKeywordInfo(uk)
     self.assertEquals(kw_info.longname, 'resource.UK')
 def _get_userlibrary(self, source, *keyword_names):
     return userkeyword.UserLibrary(
         [UserKeyword(None, name) for name in keyword_names])
Пример #7
0
 def _create_keyword(self):
     kw = UserKeyword(KeywordTable(None), 'KW')
     kw.args.value = ['${a1}', '${a2}']
     kw.add_step(['Some step', '${a1}'])
     return kw
Пример #8
0
 def setUp(self):
     self.table = TestCaseFile().keyword_table
     self.kw = UserKeyword(None, 'name')
Пример #9
0
 def _create_keyword(self):
     kw = UserKeyword(KeywordTable(None), 'KW')
     kw.args.value = ['${a1}', '${a2}']
     kw.add_step(['Some step', '${a1}'])
     return kw
Пример #10
0
 def setUp(self):
     self.table = TestCaseFile().keyword_table
     self.kw = UserKeyword(None, 'name')