| Index: chrome/common/extensions/docs/server2/rietveld_patcher_test.py
|
| diff --git a/chrome/common/extensions/docs/server2/rietveld_patcher_test.py b/chrome/common/extensions/docs/server2/rietveld_patcher_test.py
|
| index c6a8a7e81678c78768bf4c254bc730aae5805eab..b4c1cdea70bf6c9e5a45a7215ab9db3d5b8ef067 100755
|
| --- a/chrome/common/extensions/docs/server2/rietveld_patcher_test.py
|
| +++ b/chrome/common/extensions/docs/server2/rietveld_patcher_test.py
|
| @@ -4,20 +4,26 @@
|
| # found in the LICENSE file.
|
|
|
| import os
|
| +import posixpath
|
| import sys
|
| import unittest
|
| from appengine_url_fetcher import AppEngineUrlFetcher
|
| +from extensions_paths import (
|
| + ARTICLES_TEMPLATES, EXTENSIONS, DOCS, JSON_TEMPLATES, PUBLIC_TEMPLATES)
|
| from fake_fetchers import ConfigureFakeFetchers
|
| from file_system import FileNotFoundError
|
| from rietveld_patcher import RietveldPatcher
|
| -from svn_constants import EXTENSIONS_PATH
|
| import url_constants
|
|
|
| +
|
| +def _PrefixWith(prefix, lst):
|
| + return [posixpath.join(prefix, item) for item in lst]
|
| +
|
| +
|
| class RietveldPatcherTest(unittest.TestCase):
|
| def setUp(self):
|
| ConfigureFakeFetchers()
|
| self._patcher = RietveldPatcher(
|
| - EXTENSIONS_PATH,
|
| '14096030',
|
| AppEngineUrlFetcher(url_constants.CODEREVIEW_SERVER))
|
|
|
| @@ -37,20 +43,21 @@ class RietveldPatcherTest(unittest.TestCase):
|
|
|
| def testGetPatchedFiles(self):
|
| added, deleted, modified = self._patcher.GetPatchedFiles()
|
| - self.assertEqual(sorted(added),
|
| - sorted([
|
| - u'docs/templates/articles/test_foo.html',
|
| - u'docs/templates/public/extensions/test_foo.html']))
|
| - self.assertEqual(sorted(deleted),
|
| - sorted([
|
| - u'docs/templates/public/extensions/runtime.html']))
|
| - self.assertEqual(sorted(modified),
|
| - sorted([
|
| - u'api/test.json',
|
| - u'docs/templates/json/extensions_sidenav.json']))
|
| + self.assertEqual(
|
| + sorted(added),
|
| + _PrefixWith(DOCS, ['examples/test',
|
| + 'templates/articles/test_foo.html',
|
| + 'templates/public/extensions/test_foo.html']))
|
| + self.assertEqual(deleted,
|
| + ['%s/extensions/runtime.html' % PUBLIC_TEMPLATES])
|
| + self.assertEqual(
|
| + sorted(modified),
|
| + _PrefixWith(EXTENSIONS, ['api/test.json',
|
| + 'docs/templates/json/extensions_sidenav.json',
|
| + 'manifest.h']))
|
|
|
| def testApply(self):
|
| - article_path = 'docs/templates/articles/test_foo.html'
|
| + article_path = '%s/test_foo.html' % ARTICLES_TEMPLATES
|
|
|
| # Make sure RietveldPatcher handles |binary| correctly.
|
| self.assertTrue(isinstance(self._ApplySingle(article_path, True), str),
|
| @@ -61,14 +68,12 @@ class RietveldPatcherTest(unittest.TestCase):
|
| # Apply to an added file.
|
| self.assertEqual(
|
| self._ReadLocalFile('test_foo.html'),
|
| - self._ApplySingle(
|
| - 'docs/templates/public/extensions/test_foo.html'))
|
| + self._ApplySingle('%s/extensions/test_foo.html' % PUBLIC_TEMPLATES))
|
|
|
| # Apply to a modified file.
|
| self.assertEqual(
|
| self._ReadLocalFile('extensions_sidenav.json'),
|
| - self._ApplySingle(
|
| - 'docs/templates/json/extensions_sidenav.json'))
|
| + self._ApplySingle('%s/extensions_sidenav.json' % JSON_TEMPLATES))
|
|
|
| # Applying to a deleted file doesn't throw exceptions. It just returns
|
| # empty content.
|
|
|