def settings(self):
     result = [
         DocumentationController(self, self._kw.doc),
         TagsController(self, self._kw.tags),
         ArgumentsController(self, self._kw.args), self.teardown,
         ReturnValueController(self, self._kw.return_),
         TimeoutController(self, self._kw.timeout)
     ]
     return result
Exemple #2
0
 def _settings(self):
     ss = self.data.setting_table
     return [
         DocumentationController(self, ss.doc),
         FixtureController(self, ss.suite_setup),
         FixtureController(self, ss.suite_teardown),
         FixtureController(self, ss.test_setup),
         FixtureController(self, ss.test_teardown), self.force_tags
     ]
 def settings(self):
     result = [
         DocumentationController(self, self._kw.doc),
         ArgumentsController(self, self._kw.args),
         TimeoutController(self, self._kw.timeout),
         ReturnValueController(self, self._kw.return_)
     ]
     if hasattr(self._kw, 'teardown'):
         result = result[:2] + [self.teardown] + result[2:]
     return result
Exemple #4
0
 def documentation(self):
     return DocumentationController(self, self._test.doc)
 def setUp(self):
     self.doc = Documentation('Documentation')
     self.doc.value = 'Initial doc'
     self.parent = _FakeParent()
     self.ctrl = DocumentationController(self.parent, self.doc)
class DocumentationControllerTest(unittest.TestCase):

    def setUp(self):
        self.doc = Documentation('Documentation')
        self.doc.value = 'Initial doc'
        self.parent = _FakeParent()
        self.ctrl = DocumentationController(self.parent, self.doc)

    def test_creation(self):
        assert_equals(self.ctrl.display_value, 'Initial doc')
        assert_true(self.ctrl.datafile is None)
        ctrl = DocumentationController(self.parent, Documentation('[Documentation]'))
        assert_equals(ctrl.label, 'Documentation')

    def test_setting_value(self):
        self.ctrl.set_value('Doc changed')
        assert_equals(self.doc.value, 'Doc changed')
        self.ctrl.set_value('Doc changed | again')
        assert_equals(self.doc.value, 'Doc changed | again')

    def test_get_editable_value(self):
        self.doc.value = 'My doc \\n with enters \\\\\\r\\n and \\t tabs and escapes \\\\n \\\\\\\\r'
        assert_equals(self.ctrl.editable_value, 'My doc \n with enters \\\\\n'
                                                ' and \\t tabs and escapes \\\\n \\\\\\\\r')

    def test_set_editable_value(self):
        test_text = '''My doc
 with enters
 and \t tabs'''
        self.ctrl.editable_value = test_text
        assert_equals(self.doc.value, 'My doc\\n with enters\\n and \t tabs')
        assert_equals(self.ctrl.editable_value, test_text)

    def test_set_editable_value_should_escape_leading_hash(self):
        self.ctrl.editable_value = '# Not # Comment'
        assert_equals(self.doc.value, '\\# Not # Comment')
        assert_equals(self.ctrl.editable_value, '\\# Not # Comment')

    def test_get_visible_value(self):
        self.doc.value = 'My doc \\n with enters \\n and \t tabs'
        assert_equals(self.ctrl.visible_value, '''My doc <br />
with enters <br />
and &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tabs''')

    def test_setting_value_informs_parent_controller_about_dirty_model(self):
        self.ctrl.set_value('Blaa')
        assert_true(self.ctrl.dirty)

    def test_set_empty_value(self):
        self.ctrl.set_value('')
        assert_equals(self.doc.value, '')
        assert_true(self.ctrl.dirty)

    def test_same_value(self):
        self.ctrl.set_value('Initial doc')
        assert_false(self.ctrl.dirty)

    def test_clear(self):
        self.ctrl.clear()
        assert_equals(self.doc.value, '')
        assert_true(self.ctrl.dirty)
Exemple #7
0
 def test_creation(self):
     assert_equals(self.ctrl.display_value, 'Initial doc')
     assert_true(self.ctrl.datafile is None)
     ctrl = DocumentationController(self.parent, Documentation('[Documentation]'))
     assert_equals(ctrl.label, 'Documentation')
Exemple #8
0
 def setUp(self):
     self.doc = Documentation('Documentation')
     self.doc.value = 'Initial doc'
     self.parent = _FakeParent()
     self.ctrl = DocumentationController(self.parent, self.doc)
Exemple #9
0
class DocumentationControllerTest(unittest.TestCase):

    def setUp(self):
        self.doc = Documentation('Documentation')
        self.doc.value = 'Initial doc'
        self.parent = _FakeParent()
        self.ctrl = DocumentationController(self.parent, self.doc)

    def test_creation(self):
        assert_equals(self.ctrl.display_value, 'Initial doc')
        assert_true(self.ctrl.datafile is None)
        ctrl = DocumentationController(self.parent, Documentation('[Documentation]'))
        assert_equals(ctrl.label, 'Documentation')

    def test_setting_value(self):
        self.ctrl.set_value('Doc changed')
        assert_equals(self.doc.value, 'Doc changed')
        self.ctrl.set_value('Doc changed | again')
        assert_equals(self.doc.value, 'Doc changed | again')

    def test_get_editable_value(self):
        self.doc.value = 'My doc \\n with enters \\\\\\r\\n and \\t tabs and escapes \\\\n \\\\\\\\r'
        assert_equals(self.ctrl.editable_value, 'My doc \n with enters \\\\\n'
                                                ' and \\t tabs and escapes \\\\n \\\\\\\\r')

    def test_set_editable_value(self):
        test_text = '''My doc
 with enters
 and \t tabs'''
        self.ctrl.editable_value = test_text
        assert_equals(self.doc.value, 'My doc\\n with enters\\n and \t tabs')
        assert_equals(self.ctrl.editable_value, test_text)

    def test_set_editable_value_should_escape_leading_hash(self):
        self.ctrl.editable_value = '# Not # Comment'
        assert_equals(self.doc.value, '\\# Not # Comment')
        assert_equals(self.ctrl.editable_value, '\\# Not # Comment')

    def test_get_visible_value(self):
        self.doc.value = 'My doc \\n with enters \\n and \t tabs'
        assert_equals(self.ctrl.visible_value, '<p>My doc with enters and \t tabs</p>')

    def test_setting_value_informs_parent_controller_about_dirty_model(self):
        self.ctrl.set_value('Blaa')
        assert_true(self.ctrl.dirty)

    def test_set_empty_value(self):
        self.ctrl.set_value('')
        assert_equals(self.doc.value, '')
        assert_true(self.ctrl.dirty)

    def test_same_value(self):
        self.ctrl.set_value('Initial doc')
        assert_false(self.ctrl.dirty)

    def test_clear(self):
        self.ctrl.clear()
        assert_equals(self.doc.value, '')
        assert_true(self.ctrl.dirty)
Exemple #10
0
 def setUp(self):
     self.doc = Documentation("Documentation")
     self.doc.value = "Initial doc"
     self.parent = _FakeParent()
     self.ctrl = DocumentationController(self.parent, self.doc)
Exemple #11
0
class DocumentationControllerTest(unittest.TestCase):
    def setUp(self):
        self.doc = Documentation("Documentation")
        self.doc.value = "Initial doc"
        self.parent = _FakeParent()
        self.ctrl = DocumentationController(self.parent, self.doc)

    def test_creation(self):
        assert_equals(self.ctrl.display_value, "Initial doc")
        assert_true(self.ctrl.datafile is None)
        ctrl = DocumentationController(self.parent, Documentation("[Documentation]"))
        assert_equals(ctrl.label, "Documentation")

    def test_setting_value(self):
        self.ctrl.set_value("Doc changed")
        assert_equals(self.doc.value, "Doc changed")
        self.ctrl.set_value("Doc changed | again")
        assert_equals(self.doc.value, "Doc changed | again")

    def test_get_editable_value(self):
        self.doc.value = "My doc \\n with enters \\\\\\r\\n and \\t tabs and escapes \\\\n \\\\\\\\r"
        assert_equals(
            self.ctrl.editable_value, "My doc \n with enters \\\\\n" " and \\t tabs and escapes \\\\n \\\\\\\\r"
        )

    def test_set_editable_value(self):
        test_text = """My doc
 with enters
 and \t tabs"""
        self.ctrl.editable_value = test_text
        assert_equals(self.doc.value, "My doc\\n with enters\\n and \t tabs")
        assert_equals(self.ctrl.editable_value, test_text)

    def test_set_editable_value_should_escape_leading_hash(self):
        self.ctrl.editable_value = "# Not # Comment"
        assert_equals(self.doc.value, "\\# Not # Comment")
        assert_equals(self.ctrl.editable_value, "\\# Not # Comment")

    def test_get_visible_value(self):
        self.doc.value = "My doc \\n with enters \\n and \t tabs"
        assert_equals(self.ctrl.visible_value, "<p>My doc with enters and \t tabs</p>")

    def test_setting_value_informs_parent_controller_about_dirty_model(self):
        self.ctrl.set_value("Blaa")
        assert_true(self.ctrl.dirty)

    def test_set_empty_value(self):
        self.ctrl.set_value("")
        assert_equals(self.doc.value, "")
        assert_true(self.ctrl.dirty)

    def test_same_value(self):
        self.ctrl.set_value("Initial doc")
        assert_false(self.ctrl.dirty)

    def test_clear(self):
        self.ctrl.clear()
        assert_equals(self.doc.value, "")
        assert_true(self.ctrl.dirty)
Exemple #12
0
 def _settings(self):
     return [DocumentationController(self, self.data.setting_table.doc)]