Chromium Code Reviews| Index: chrome/common/extensions/docs/server2/test_urlfetch.py |
| diff --git a/chrome/common/extensions/docs/server2/test_urlfetch.py b/chrome/common/extensions/docs/server2/test_urlfetch.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..547056ecdb7626f64785f3d4be08e978ea13239e |
| --- /dev/null |
| +++ b/chrome/common/extensions/docs/server2/test_urlfetch.py |
| @@ -0,0 +1,16 @@ |
| +# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +def ReadFile(filename): |
| + with open(filename, 'r') as f: |
| + return f.read() |
| + |
| +def fetch(url): |
| + result = MockResponse() |
| + result.content = ReadFile('test_data/' + url) |
| + return result |
| + |
|
Aaron Boodman
2012/05/24 06:10:23
Prefix ReadFile and MockResponse with _ to make cl
cduvall
2012/05/25 20:02:23
Done.
|
| +class MockResponse(object): |
|
Aaron Boodman
2012/05/24 06:10:23
Move this up above fetch()? (I'm surprised it comp
cduvall
2012/05/25 20:02:23
Done.
|
| + def __init__(self): |
| + self.content = '' |