Chromium Code Reviews| Index: chrome/common/extensions/docs/server2/intro_data_source_test.py |
| diff --git a/chrome/common/extensions/docs/server2/intro_data_source_test.py b/chrome/common/extensions/docs/server2/intro_data_source_test.py |
| index 7e8e8942e5d17c0a8b6f82a7a777f8b6e8cc8eeb..a4d4c0e9fe9c55e922dde786fabd9a1fbc1532d1 100755 |
| --- a/chrome/common/extensions/docs/server2/intro_data_source_test.py |
| +++ b/chrome/common/extensions/docs/server2/intro_data_source_test.py |
| @@ -3,23 +3,28 @@ |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| +import json |
| +import os |
| + |
| +from fake_fetchers import ConfigureFakeFetchers |
| from server_instance import ServerInstance |
| -import svn_constants |
| from test_file_system import TestFileSystem |
| import unittest |
| -_TEST_DATA = TestFileSystem.MoveTo(svn_constants.INTRO_PATH, { |
| - 'test.html': '<h1>hello</h1>world<h2>first</h2><h3>inner</h3><h2>second</h2>' |
| -}) |
| +def _LoadJson(name, mode='rb'): |
| + return json.load( |
| + open(os.path.join('test_data', 'test_json', name), mode)) |
| class IntroDataSourceTest(unittest.TestCase): |
| def setUp(self): |
| - self._server = ServerInstance.ForTest(TestFileSystem(_TEST_DATA)) |
| + ConfigureFakeFetchers() |
|
not at google - send to devlin
2013/05/13 21:26:41
shouldnt' need this.
epeterson
2013/05/15 07:38:34
Done.
|
| + self._server = ServerInstance.ForTest( |
| + TestFileSystem(_LoadJson('basic_docs_filesystem.json'))) |
| def testIntro(self): |
| intro_data_source = self._server.intro_data_source_factory.Create() |
| data = intro_data_source.get('test') |
| - self.assertEqual('hello', data['title']) |
| + self.assertEqual('hi', data['title']) |
| # TODO(kalman): test links. |
| expected_toc = [{'subheadings': [{'link': '', 'title': u'inner'}], |
| 'link': '', |
| @@ -27,7 +32,7 @@ class IntroDataSourceTest(unittest.TestCase): |
| {'subheadings': [], 'link': '', 'title': u'second'}] |
| self.assertEqual(expected_toc, data['apps_toc']) |
| self.assertEqual(expected_toc, data['extensions_toc']) |
| - self.assertEqual('world<h2>first</h2><h3>inner</h3><h2>second</h2>', |
| + self.assertEqual('you<h2>first</h2><h3>inner</h3><h2>second</h2>', |
| data['intro'].render().text) |
| if __name__ == '__main__': |