Exemplo n.º 1
0
def make_page_fixture(page_id=None, title=None, body=None, space_key='TEST'):
    p = Page()
    p.id = page_id
    p.space_key = space_key
    p.title = title
    p.body = body
    return p
def make_page_fixture(page_id=None, title=None, body=None, space_key='TEST'):
    p = Page()
    p.id = page_id
    p.space_key = space_key
    p.title = title
    p.body = body
    return p
    def test_eq(self):
        fixture_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'fixtures', 'page_body.html')
        body_fixture = codecs.open(fixture_file, 'r', encoding='utf-8').read()

        first_ancestor = Ancestor()
        first_ancestor.id = 12344

        first = Page()
        first.id = 12345
        first.type = 'page'
        first.body = body_fixture

        first.ancestors.append(first_ancestor)

        second = copy.deepcopy(first)

        self.assertTrue(first == second)
    def test_eq(self):
        fixture_file = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                                    'fixtures', 'page_body.html')
        body_fixture = codecs.open(fixture_file, 'r', encoding='utf-8').read()

        first_ancestor = Ancestor()
        first_ancestor.id = 12344

        first = Page()
        first.id = 12345
        first.type = 'page'
        first.body = body_fixture

        first.ancestors.append(first_ancestor)

        second = copy.deepcopy(first)

        self.assertTrue(first == second)
Exemplo n.º 5
0
    def __init__(self):
        self.config = ConfigLoader.from_dict({
            'version':
            2,
            'base_dir':
            'fixtures',
            'pages': [{
                'id': 1,
                'source': 'page',
                'attachments': {
                    'images': ['test_image.png'],
                    'downloads': ['test_download.txt'],
                }
            }, {
                'source': 'page',
                'title': 'cfgTitle'
            }, {
                'id': 1,
                'source': 'titeless_page',
                'watermark': 'just mark it!',
                'link': 'http://localhost:8080/index.htm'
            }]
        })

        page = Page()
        page.id = 1
        page.title = u'pageTitle'
        page.unused_title = u'Useless'
        page.body = u'''
            Body
            <a href="{}">Title</a>
            <a href="{}">Unused</a>
        '''.format(page.title, page.unused_title)

        self.tests_root = os.path.dirname(os.path.abspath(__file__))
        self.data_provider = SphinxFJsonDataProvider(
            root_dir=self.tests_root, base_dir=self.config.base_dir)
        self.page_manager = FakePagePublisher([page])
        self.attachment_manager = FakeAttachmentPublisher()