Index: tools/telemetry/third_party/gsutilz/third_party/apitools/apitools/base/py/http_wrapper_test.py |
diff --git a/tools/telemetry/third_party/gsutilz/third_party/apitools/apitools/base/py/http_wrapper_test.py b/tools/telemetry/third_party/gsutilz/third_party/apitools/apitools/base/py/http_wrapper_test.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ddb927a4c511f6c615ff186807402b101bc1d135 |
--- /dev/null |
+++ b/tools/telemetry/third_party/gsutilz/third_party/apitools/apitools/base/py/http_wrapper_test.py |
@@ -0,0 +1,24 @@ |
+"""Tests for http_wrapper.""" |
+import unittest2 |
+ |
+from apitools.base.py import http_wrapper |
+ |
+ |
+class RaisesExceptionOnLen(object): |
+ |
+ """Supports length property but raises if __len__ is used.""" |
+ |
+ def __len__(self): |
+ raise Exception('len() called unnecessarily') |
+ |
+ def length(self): |
+ return 1 |
+ |
+ |
+class HttpWrapperTest(unittest2.TestCase): |
+ |
+ def testRequestBodyUsesLengthProperty(self): |
+ http_wrapper.Request(body=RaisesExceptionOnLen()) |
+ |
+ def testRequestBodyWithLen(self): |
+ http_wrapper.Request(body='burrito') |