2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 from intro_data_source
import IntroDataSource
7 from server_instance
import ServerInstance
8 from servlet
import Request
9 from test_data
.canned_data
import CANNED_TEST_FILE_SYSTEM_DATA
10 from test_file_system
import TestFileSystem
13 class IntroDataSourceTest(unittest
.TestCase
):
15 self
._server
_instance
= ServerInstance
.ForTest(
16 TestFileSystem(CANNED_TEST_FILE_SYSTEM_DATA
))
19 intro_data_source
= IntroDataSource(
20 self
._server
_instance
, Request
.ForTest(''))
21 intro_data
= intro_data_source
.get('test_intro')
22 article_data
= intro_data_source
.get('test_article')
24 expected_intro
= 'you<h2>first</h2><h3>inner</h3><h2>second</h2>'
25 # Article still has the header.
26 expected_article
= '<h1>hi</h1>' + expected_intro
28 self
.assertEqual(expected_intro
, intro_data
.Render().text
)
29 self
.assertEqual(expected_article
, article_data
.Render().text
)
32 if __name__
== '__main__':