OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 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. |
| 5 |
| 6 import unittest |
| 7 |
| 8 from fake_fetchers import ConfigureFakeFetchers |
| 9 from handler import Handler |
| 10 from servlet import Request |
| 11 |
| 12 class HandlerTest(unittest.TestCase): |
| 13 def setUp(self): |
| 14 ConfigureFakeFetchers() |
| 15 |
| 16 def testCodeGoogleRedirect(self): |
| 17 response = Handler(Request('chrome/extensions/storage.html', |
| 18 'http://code.google.com', |
| 19 {})).Get() |
| 20 self.assertEqual(302, response.status) |
| 21 self.assertEqual('http://developer.chrome.com/extensions/storage.html', |
| 22 response.headers.get('Location')) |
| 23 |
| 24 def testDeveloperGoogleRedirect(self): |
| 25 response = Handler(Request.ForTest('')).Get() |
| 26 self.assertEqual(302, response.status) |
| 27 self.assertEqual('http://developer.google.com/chrome', |
| 28 response.headers.get('Location')) |
| 29 |
| 30 def testAppRedirect(self): |
| 31 response = Handler(Request.ForTest('apps.html')).Get() |
| 32 self.assertEqual(302, response.status) |
| 33 self.assertEqual('/apps/about_apps.html', response.headers.get('Location')) |
| 34 |
| 35 if __name__ == '__main__': |
| 36 unittest.main() |
OLD | NEW |