Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: chrome/common/extensions/docs/server2/content_provider_test.py

Issue 240303006: Docs: Remove unnecessary redirects from directories to 'index' files since we (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 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 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 from cStringIO import StringIO 6 from cStringIO import StringIO
7 import json 7 import json
8 import unittest 8 import unittest
9 from zipfile import ZipFile 9 from zipfile import ZipFile
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 }, 56 },
57 'dir6': { 57 'dir6': {
58 'notindex.html': 'notindex.html content' 58 'notindex.html': 'notindex.html content'
59 }, 59 },
60 'dir7': { 60 'dir7': {
61 'index.md': '\n'.join(text[0] for text in _MARKDOWN_CONTENT) 61 'index.md': '\n'.join(text[0] for text in _MARKDOWN_CONTENT)
62 }, 62 },
63 'dir.txt': 'dir.txt content', 63 'dir.txt': 'dir.txt content',
64 'dir5.html': 'dir5.html content', 64 'dir5.html': 'dir5.html content',
65 'img.png': 'img.png content', 65 'img.png': 'img.png content',
66 'index.html': 'index.html content',
66 'read.txt': 'read.txt content', 67 'read.txt': 'read.txt content',
67 'redirects.json': _REDIRECTS_JSON, 68 'redirects.json': _REDIRECTS_JSON,
68 'noextension': 'noextension content', 69 'noextension': 'noextension content',
69 'run.js': 'run.js content', 70 'run.js': 'run.js content',
70 'site.css': 'site.css content', 71 'site.css': 'site.css content',
71 'storage.html': 'storage.html content', 72 'storage.html': 'storage.html content',
72 'markdown.md': '\n'.join(text[0] for text in _MARKDOWN_CONTENT) 73 'markdown.md': '\n'.join(text[0] for text in _MARKDOWN_CONTENT)
73 } 74 }
74 75
75 76
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 self._assertMarkdownContent( 177 self._assertMarkdownContent(
177 '\n'.join(text[1] for text in _MARKDOWN_CONTENT), 178 '\n'.join(text[1] for text in _MARKDOWN_CONTENT),
178 'markdown') 179 'markdown')
179 180
180 def testNotFound(self): 181 def testNotFound(self):
181 self.assertRaises( 182 self.assertRaises(
182 FileNotFoundError, 183 FileNotFoundError,
183 self._content_provider.GetContentAndType('oops').Get) 184 self._content_provider.GetContentAndType('oops').Get)
184 185
185 def testIndexRedirect(self): 186 def testIndexRedirect(self):
187 self._assertTemplateContent(u'index.html content', '')
186 self._assertTemplateContent(u'index.html content 1', 'dir4') 188 self._assertTemplateContent(u'index.html content 1', 'dir4')
187 self._assertTemplateContent(u'dir5.html content', 'dir5') 189 self._assertTemplateContent(u'dir5.html content', 'dir5')
188 self._assertMarkdownContent( 190 self._assertMarkdownContent(
189 '\n'.join(text[1] for text in _MARKDOWN_CONTENT), 191 '\n'.join(text[1] for text in _MARKDOWN_CONTENT),
190 'dir7') 192 'dir7')
191 self._assertContent( 193 self._assertContent(
192 'noextension content', 'text/plain', 194 'noextension content', 'text/plain',
193 self._content_provider.GetContentAndType('noextension').Get()) 195 self._content_provider.GetContentAndType('noextension').Get())
194 self.assertRaises( 196 self.assertRaises(
195 FileNotFoundError, 197 FileNotFoundError,
196 self._content_provider.GetContentAndType('dir6').Get) 198 self._content_provider.GetContentAndType('dir6').Get)
197 199
198 if __name__ == '__main__': 200 if __name__ == '__main__':
199 unittest.main() 201 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698