diff -Nru python-httpretty-0.8.0/debian/changelog python-httpretty-0.8.0/debian/changelog --- python-httpretty-0.8.0/debian/changelog 2014-04-30 08:46:04.000000000 +0000 +++ python-httpretty-0.8.0/debian/changelog 2014-07-18 16:09:58.000000000 +0000 @@ -1,39 +1,54 @@ -python-httpretty (0.8.0-2) unstable; urgency=medium +python-httpretty (0.8.0-0ubuntu4) precise; urgency=low - * Added python3 support. - * Allow the unit tests to fail, because they do with the last version of - python-sure (Closes: #746118). + * No-change backport to precise - -- Thomas Goirand Thu, 03 Apr 2014 15:44:09 +0800 + -- Lars Butler (larsbutler) Fri, 18 Jul 2014 16:09:28 +0000 -python-httpretty (0.8.0-1) unstable; urgency=medium +python-httpretty (0.8.0-0ubuntu3) trusty; urgency=medium - * New upstream release. - * Removed tests removal, because upstream did remove the tests files from the - setup.py. - * reviewed (build-)dependencies. + * debian/rules: Really disable tests. + + -- Chuck Short Fri, 07 Feb 2014 08:58:58 -0500 + +python-httpretty (0.8.0-0ubuntu2) trusty; urgency=medium + + * debian/rules: Temporarily disable tests. - -- Thomas Goirand Thu, 06 Mar 2014 22:20:14 +0800 + -- Chuck Short Thu, 06 Feb 2014 14:15:49 -0500 -python-httpretty (0.7.1-3) unstable; urgency=medium +python-httpretty (0.8.0-0ubuntu1) trusty; urgency=medium - * Do not package the test folder. (Closes: #738210) + * New upstream release: + - debian/patches/fix-ubuntu-tests.patch: Dropped no longer needed. + + -- Chuck Short Tue, 04 Feb 2014 09:31:38 -0500 + +python-httpretty (0.7.1-0ubuntu1) trusty; urgency=medium + + * New upstream release. + * debian/control: + - Drop python-misaka dependency, not needed. + - Replaced python-httplib2 run time dependency with python-urllib3. + - Added python-tornado as a build time dependency. - -- Thomas Goirand Sun, 09 Feb 2014 18:06:15 +0800 + -- Chuck Short Mon, 03 Feb 2014 11:06:33 -0500 -python-httpretty (0.7.1-2) unstable; urgency=medium +python-httpretty (0.7.0-0ubuntu2) trusty; urgency=low - * Added missing build-depends: python-mock, python-nose. + * debian/control: + - Dont install python-nose and python-mock as a runtime dependency. + - Add python-sure as a build-dependency. + * debian/rules: Enable testsuite. + * debian/patches/fix-ubuntu-tests.patch: Fix testsuite to build with Ubuntu. - -- Thomas Goirand Sat, 08 Feb 2014 15:18:07 +0800 + -- Chuck Short Thu, 14 Nov 2013 10:31:10 -0500 -python-httpretty (0.7.1-1) unstable; urgency=medium +python-httpretty (0.7.0-0ubuntu1) trusty; urgency=low * New upstream release. - * Adds unit tests run. - * Standards-Version: is now 3.9.5. + * debian/watch: Fixed url. - -- Thomas Goirand Mon, 30 Dec 2013 16:09:41 +0800 + -- Chuck Short Thu, 24 Oct 2013 14:46:42 -0700 python-httpretty (0.6.3+20130727+git9d03c1cf-1) unstable; urgency=low diff -Nru python-httpretty-0.8.0/debian/control python-httpretty-0.8.0/debian/control --- python-httpretty-0.8.0/debian/control 2014-04-30 08:46:04.000000000 +0000 +++ python-httpretty-0.8.0/debian/control 2014-02-04 14:43:08.000000000 +0000 @@ -1,27 +1,17 @@ Source: python-httpretty Section: python Priority: optional -Maintainer: PKG OpenStack +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: PKG OpenStack Uploaders: Julien Danjou , Thomas Goirand , Mehdi Abaakouk -Build-Depends: debhelper (>= 9), openstack-pkg-tools, python-all (>= 2.6.6-3~), python-setuptools, python3-all (>= 3.2), python3-setuptools -Build-Depends-Indep: python-coverage, - python-httplib2, - python-mock, - python-nose, - python-requests, - python-sure, - python-tornado, - python-urllib3, - python3-httplib2, - python3-mock, - python3-nose, - python3-requests, - python3-sure, - python3-tornado, - python3-urllib3 -Standards-Version: 3.9.5 +Build-Depends: debhelper (>= 9), + openstack-pkg-tools, + python-all (>= 2.6.6-3~), python-urllib3, python-sure, + python-setuptools, python-mock, python-nose, python-requests, + python-tornado, python-urllib3, python-httplib2 +Standards-Version: 3.9.4 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=openstack/python-httpretty.git Vcs-Git: git://anonscm.debian.org/openstack/python-httpretty.git Homepage: http://github.com/gabrielfalcao/httpretty @@ -29,25 +19,13 @@ Package: python-httpretty Architecture: all Pre-Depends: dpkg (>= 1.15.6~) -Depends: python-urllib3, ${misc:Depends}, ${python:Depends} -Description: HTTP client mock - Python 2.x +Depends: python-urllib3, + ${misc:Depends}, + ${python:Depends} +Recommends: ${python:Recommends} +Description: HTTP client mock for Python Once upon a time a Python developer wanted to use a RESTful API, everything was fine but until the day he needed to test the code that hits the RESTful API: what if the API server is down? What if its content has changed ? . Don't worry, HTTPretty is here for you. - . - This package provides the Python 2.x module. - -Package: python3-httpretty -Architecture: all -Pre-Depends: dpkg (>= 1.15.6~) -Depends: python3-urllib3, ${misc:Depends}, ${python3:Depends} -Description: HTTP client mock - Python 3.x - Once upon a time a Python developer wanted to use a RESTful API, everything - was fine but until the day he needed to test the code that hits the RESTful - API: what if the API server is down? What if its content has changed ? - . - Don't worry, HTTPretty is here for you. - . - This package provides the Python 3.x module. diff -Nru python-httpretty-0.8.0/debian/patches/remove-problematic-unicode-chars-in-comments.patch python-httpretty-0.8.0/debian/patches/remove-problematic-unicode-chars-in-comments.patch --- python-httpretty-0.8.0/debian/patches/remove-problematic-unicode-chars-in-comments.patch 2014-04-30 08:46:04.000000000 +0000 +++ python-httpretty-0.8.0/debian/patches/remove-problematic-unicode-chars-in-comments.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,205 +0,0 @@ -Description: Removes problematic unicode chars in comments - Under some circonstances, using Python 3.2, the call of: - python setup.py install - would produce this: - Traceback (most recent call last): - File "setup.py", line 86, in - version=read_version(), - File "setup.py", line 46, in read_version - finder.visit(ast.parse(local_file('httpretty', '__init__.py'))) - File "setup.py", line 78, in - open(os.path.join(os.path.dirname(__file__), *f)).read() - File "/usr/lib/python3.2/encodings/ascii.py", line 26, in decode - return codecs.ascii_decode(input, self.errors)[0] - UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 133: ordinal not in range(128) -Author: Thomas Goirand -Forwarded: no -Last-Update: 2014-04-13 - ---- python-httpretty-0.8.0.orig/readme.rst -+++ python-httpretty-0.8.0/readme.rst -@@ -483,7 +483,7 @@ License - :: - - -- Copyright (C) <2011-2013> Gabriel Falcão -+ Copyright (C) <2011-2013> Gabriel Falcao - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation ---- python-httpretty-0.8.0.orig/tests/functional/test_bypass.py -+++ python-httpretty-0.8.0/tests/functional/test_bypass.py -@@ -2,7 +2,7 @@ - # -*- coding: utf-8 -*- - - # --# Copyright (C) <2011-2013> Gabriel Falcão -+# Copyright (C) <2011-2013> Gabriel Falcao - # - # Permission is hereby granted, free of charge, to any person - # obtaining a copy of this software and associated documentation ---- python-httpretty-0.8.0.orig/tests/functional/base.py -+++ python-httpretty-0.8.0/tests/functional/base.py -@@ -2,7 +2,7 @@ - # -*- coding: utf-8 -*- - - # --# Copyright (C) <2011-2013> Gabriel Falcão -+# Copyright (C) <2011-2013> Gabriel Falcao - # - # Permission is hereby granted, free of charge, to any person - # obtaining a copy of this software and associated documentation ---- python-httpretty-0.8.0.orig/tests/functional/testserver.py -+++ python-httpretty-0.8.0/tests/functional/testserver.py -@@ -2,7 +2,7 @@ - # -*- coding: utf-8 -*- - # - # --# Copyright (C) <2011-2013> Gabriel Falcão -+# Copyright (C) <2011-2013> Gabriel Falcao - # - # Permission is hereby granted, free of charge, to any person - # obtaining a copy of this software and associated documentation ---- python-httpretty-0.8.0.orig/tests/functional/__init__.py -+++ python-httpretty-0.8.0/tests/functional/__init__.py -@@ -1,7 +1,7 @@ - # #!/usr/bin/env python - # -*- coding: utf-8 -*- - # --# Copyright (C) <2011-2013> Gabriel Falcão -+# Copyright (C) <2011-2013> Gabriel Falcao - # - # Permission is hereby granted, free of charge, to any person - # obtaining a copy of this software and associated documentation ---- python-httpretty-0.8.0.orig/tests/functional/test_requests.py -+++ python-httpretty-0.8.0/tests/functional/test_requests.py -@@ -2,7 +2,7 @@ - # -*- coding: utf-8 -*- - - # --# Copyright (C) <2011-2013> Gabriel Falcão -+# Copyright (C) <2011-2013> Gabriel Falcao - # - # Permission is hereby granted, free of charge, to any person - # obtaining a copy of this software and associated documentation ---- python-httpretty-0.8.0.orig/tests/functional/test_httplib2.py -+++ python-httpretty-0.8.0/tests/functional/test_httplib2.py -@@ -2,7 +2,7 @@ - # -*- coding: utf-8 -*- - - # --# Copyright (C) <2011-2013> Gabriel Falcão -+# Copyright (C) <2011-2013> Gabriel Falcao - # - # Permission is hereby granted, free of charge, to any person - # obtaining a copy of this software and associated documentation ---- python-httpretty-0.8.0.orig/tests/functional/test_urllib2.py -+++ python-httpretty-0.8.0/tests/functional/test_urllib2.py -@@ -2,7 +2,7 @@ - # -*- coding: utf-8 -*- - - # --# Copyright (C) <2011-2013> Gabriel Falcão -+# Copyright (C) <2011-2013> Gabriel Falcao - # - # Permission is hereby granted, free of charge, to any person - # obtaining a copy of this software and associated documentation ---- python-httpretty-0.8.0.orig/tests/functional/test_debug.py -+++ python-httpretty-0.8.0/tests/functional/test_debug.py -@@ -2,7 +2,7 @@ - # -*- coding: utf-8 -*- - - # --# Copyright (C) <2011-2013> Gabriel Falcão -+# Copyright (C) <2011-2013> Gabriel Falcao - # - # Permission is hereby granted, free of charge, to any person - # obtaining a copy of this software and associated documentation ---- python-httpretty-0.8.0.orig/tests/unit/__init__.py -+++ python-httpretty-0.8.0/tests/unit/__init__.py -@@ -1,7 +1,7 @@ - # #!/usr/bin/env python - # -*- coding: utf-8 -*- - # --# Copyright (C) <2011-2013> Gabriel Falcão -+# Copyright (C) <2011-2013> Gabriel Falcao - # - # Permission is hereby granted, free of charge, to any person - # obtaining a copy of this software and associated documentation ---- python-httpretty-0.8.0.orig/tests/unit/test_httpretty.py -+++ python-httpretty-0.8.0/tests/unit/test_httpretty.py -@@ -2,7 +2,7 @@ - # -*- coding: utf-8 -*- - - # --# Copyright (C) <2011-2013> Gabriel Falcão -+# Copyright (C) <2011-2013> Gabriel Falcao - # - # Permission is hereby granted, free of charge, to any person - # obtaining a copy of this software and associated documentation ---- python-httpretty-0.8.0.orig/httpretty/__init__.py -+++ python-httpretty-0.8.0/httpretty/__init__.py -@@ -1,7 +1,7 @@ - # #!/usr/bin/env python - # -*- coding: utf-8 -*- - # --# Copyright (C) <2011-2013> Gabriel Falcão -+# Copyright (C) <2011-2013> Gabriel Falcao - # - # Permission is hereby granted, free of charge, to any person - # obtaining a copy of this software and associated documentation ---- python-httpretty-0.8.0.orig/httpretty/compat.py -+++ python-httpretty-0.8.0/httpretty/compat.py -@@ -2,7 +2,7 @@ - # -*- coding: utf-8 -*- - # - # --# Copyright (C) <2011-2013> Gabriel Falcão -+# Copyright (C) <2011-2013> Gabriel Falcao - # - # Permission is hereby granted, free of charge, to any person - # obtaining a copy of this software and associated documentation ---- python-httpretty-0.8.0.orig/httpretty/http.py -+++ python-httpretty-0.8.0/httpretty/http.py -@@ -1,7 +1,7 @@ - # #!/usr/bin/env python - # -*- coding: utf-8 -*- - # --# Copyright (C) <2011-2013> Gabriel Falcão -+# Copyright (C) <2011-2013> Gabriel Falcao - # - # Permission is hereby granted, free of charge, to any person - # obtaining a copy of this software and associated documentation ---- python-httpretty-0.8.0.orig/httpretty/core.py -+++ python-httpretty-0.8.0/httpretty/core.py -@@ -1,7 +1,7 @@ - # #!/usr/bin/env python - # -*- coding: utf-8 -*- - # --# Copyright (C) <2011-2013> Gabriel Falcão -+# Copyright (C) <2011-2013> Gabriel Falcao - # - # Permission is hereby granted, free of charge, to any person - # obtaining a copy of this software and associated documentation ---- python-httpretty-0.8.0.orig/httpretty/errors.py -+++ python-httpretty-0.8.0/httpretty/errors.py -@@ -2,7 +2,7 @@ - # -*- coding: utf-8 -*- - # - # --# Copyright (C) <2011-2013> Gabriel Falcão -+# Copyright (C) <2011-2013> Gabriel Falcao - # - # Permission is hereby granted, free of charge, to any person - # obtaining a copy of this software and associated documentation ---- python-httpretty-0.8.0.orig/httpretty/utils.py -+++ python-httpretty-0.8.0/httpretty/utils.py -@@ -1,7 +1,7 @@ - # #!/usr/bin/env python - # -*- coding: utf-8 -*- - # --# Copyright (C) <2011-2013> Gabriel Falcão -+# Copyright (C) <2011-2013> Gabriel Falcao - # - # Permission is hereby granted, free of charge, to any person - # obtaining a copy of this software and associated documentation diff -Nru python-httpretty-0.8.0/debian/patches/series python-httpretty-0.8.0/debian/patches/series --- python-httpretty-0.8.0/debian/patches/series 2014-04-30 08:46:04.000000000 +0000 +++ python-httpretty-0.8.0/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -remove-problematic-unicode-chars-in-comments.patch diff -Nru python-httpretty-0.8.0/debian/rules python-httpretty-0.8.0/debian/rules --- python-httpretty-0.8.0/debian/rules 2014-04-30 08:46:04.000000000 +0000 +++ python-httpretty-0.8.0/debian/rules 2014-02-07 13:58:47.000000000 +0000 @@ -1,25 +1,10 @@ #!/usr/bin/make -f -PYTHONS:=$(shell pyversions -vr) -PYTHON3S:=$(shell py3versions -vr) - UPSTREAM_GIT = git://github.com/gabrielfalcao/HTTPretty.git include /usr/share/openstack-pkg-tools/pkgos.make %: - dh $@ --buildsystem=python_distutils --with python2,python3 - -override_dh_auto_install: - set -e && for pyvers in $(PYTHONS); do \ - python$$pyvers setup.py install --install-layout=deb \ - --root $(CURDIR)/debian/python-httpretty; \ - done - set -e && for pyvers in $(PYTHON3S); do \ - python$$pyvers setup.py install --install-layout=deb \ - --root $(CURDIR)/debian/python3-httpretty; \ - done + dh $@ --buildsystem=python_distutils --with python2 -override_dh_auto_test: -ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS))) - nosetests tests/unit || true -endif +#override_dh_auto_test: +# nosetests || true diff -Nru python-httpretty-0.8.0/debian/watch python-httpretty-0.8.0/debian/watch --- python-httpretty-0.8.0/debian/watch 2014-04-30 08:46:04.000000000 +0000 +++ python-httpretty-0.8.0/debian/watch 2013-10-24 21:51:23.000000000 +0000 @@ -1,3 +1,3 @@ version=3 -http://pypi.python.org/packages/source/h/httpretty httpretty-(.*).tar.gz +http://pypi.python.org/packages/source/h/httpretty/httpretty-(.*).tar.gz diff -Nru python-httpretty-0.8.0/docs/about.md python-httpretty-0.8.0/docs/about.md --- python-httpretty-0.8.0/docs/about.md 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/docs/about.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -# Acknowledgements - -## caveats - -### `forcing_headers` + `Content-Length` - -if you use the `forcing_headers` options make sure to add the header -`Content-Length` otherwise the -[requests](http://docs.python-requests.org/en/latest/) will try to -load the response endlessly - -## supported libraries - -Because HTTPretty works in the socket level it should work with any HTTP client libraries, although it is [battle tested](https://github.com/gabrielfalcao/HTTPretty/tree/master/tests/functional) against: - -* [requests](http://docs.python-requests.org/en/latest/) -* [httplib2](http://code.google.com/p/httplib2/) -* [urllib2](http://docs.python.org/2/library/urllib2.html) diff -Nru python-httpretty-0.8.0/docs/contributing.md python-httpretty-0.8.0/docs/contributing.md --- python-httpretty-0.8.0/docs/contributing.md 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/docs/contributing.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -# Hacking on HTTPretty - -## creating a virtual env - -you will need [virtualenvwrapper](http://www.doughellmann.com/projects/virtualenvwrapper/) - - -```console -mkvirtualenv --distribute --no-site-packages HTTPretty -``` - -## installing the dependencies - -```console -pip install -r requirements.txt -``` - -## next steps - -1. run the tests with make: -```bash -make unit functional -``` -2. hack at will -3. commit, push etc -4. send a pull request - -# License - - - Copyright (C) <2011-2013> Gabriel Falcão - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation - files (the "Software"), to deal in the Software without - restriction, including without limitation the rights to use, - copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following - conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - - -# Main contributors - -There folks made remarkable contributions to HTTPretty: - -* Steve Pulec ~> @spulec -* Hugh Saunders ~> @hughsaunders -* Matt Luongo ~> @mhluongo -* James Rowe ~> @JNRowe diff -Nru python-httpretty-0.8.0/docs/docs.md python-httpretty-0.8.0/docs/docs.md --- python-httpretty-0.8.0/docs/docs.md 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/docs/docs.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,299 +0,0 @@ -# Reference - -## testing query strings - -```python -import requests -from sure import expect -import httpretty - -def test_one(): - httpretty.enable() # enable HTTPretty so that it will monkey patch the socket module - httpretty.register_uri(httpretty.GET, "http://yipit.com/login", - body="Find the best daily deals") - - requests.get('http://yipit.com/login?email=user@github.com&password=foobar123') - expect(httpretty.last_request()).to.have.property("querystring").being.equal({ - "email": "user@github.com", - "password": "foobar123", - }) - - httpretty.disable() # disable afterwards, so that you will have no problems in code that uses that socket module -``` - - -## Using the decorator - -**YES** we've got a decorator - -```python -import requests -import httpretty - -@httpretty.activate -def test_one(): - httpretty.register_uri(httpretty.GET, "http://yipit.com/", - body="Find the best daily deals") - - response = requests.get('http://yipit.com') - assert response.text == "Find the best daily deals" -``` - -the `@httpretty.activate` is a short-hand decorator that wraps the -decorated function with httpretty.enable() and then calls -httpretty.disable() right after. - -## Providing status code - -```python -import requests -from sure import expect -import httpretty - -@httpretty.activate -def test_github_access(): - httpretty.register_uri(httpretty.GET, "http://github.com/", - body="here is the mocked body", - status=201) - - response = requests.get('http://github.com') - expect(response.status_code).to.equal(201) -``` - -## Providing custom headers - -**and all you need is to add keyword args in which the keys are always lower-cased and with underscores `_` instead of dashes `-`** - -For example, let's say you want to mock that server returns `content-type`. -To do so, use the argument `content_type`, **all the keyword args are taken by HTTPretty and transformed in the RFC2616 equivalent name**. - -```python -@httpretty.activate -def test_some_api(): - httpretty.register_uri(httpretty.GET, "http://foo-api.com/gabrielfalcao", - body='{"success": false}', - status=500, - content_type='text/json') - - response = requests.get('http://foo-api.com/gabrielfalcao') - - expect(response.json()).to.equal({'success': False}) - expect(response.status_code).to.equal(500) -``` - - -### Adding extra headers and forcing headers - -You can pass the `adding_headers` argument as a dictionary and your -headers will be -[united](http://en.wikipedia.org/wiki/Union_(set_theory)) to the -existing headers. - -```python -@httpretty.activate -def test_some_api(): - httpretty.register_uri(httpretty.GET, "http://foo-api.com/gabrielfalcao", - body='{"success": false}', - status=500, - content_type='text/json', - adding_headers={ - 'X-foo': 'bar' - }) - - response = requests.get('http://foo-api.com/gabrielfalcao') - - expect(response.json()).to.equal({'success': False}) - expect(response.status_code).to.equal(500) -``` - -Although there are some situation where some headers line -`content-length` will be calculated by HTTPretty based on the -specified fake response body. - -So you might want to *"force"* those headers: - -```python -@httpretty.activate -def test_some_api(): - httpretty.register_uri(httpretty.GET, "http://foo-api.com/gabrielfalcao", - body='{"success": false}', - status=500, - content_type='text/json', - forcing_headers={ - 'content-length': '100' - }) - - response = requests.get('http://foo-api.com/gabrielfalcao') - - expect(response.json()).to.equal({'success': False}) - expect(response.status_code).to.equal(500) -``` - -You should, though, be careful with it. The HTTP client is likely to -rely on the content length to know how many bytes of response payload -should be loaded. Forcing a `content-length` that is bigger than the -action response body might cause the HTTP client to hang because it is -waiting for data. Read more in the "caveats" session on the bottom. - -## rotating responses - -Same URL, same request method, the first request return the first -httpretty.Response, all the subsequent ones return the last (status 202). - -Notice that the `responses` argument is a list and you can pass as -many responses as you want. - -```python -import requests -from sure import expect - - -@httpretty.activate -def test_rotating_responses(): - httpretty.register_uri(httpretty.GET, "http://github.com/gabrielfalcao/httpretty", - responses=[ - httpretty.Response(body="first response", status=201), - httpretty.Response(body='second and last response', status=202), - ]) - - response1 = requests.get('http://github.com/gabrielfalcao/httpretty') - expect(response1.status_code).to.equal(201) - expect(response1.text).to.equal('first response') - - response2 = requests.get('http://github.com/gabrielfalcao/httpretty') - expect(response2.status_code).to.equal(202) - expect(response2.text).to.equal('second and last response') - - response3 = requests.get('http://github.com/gabrielfalcao/httpretty') - - expect(response3.status_code).to.equal(202) - expect(response3.text).to.equal('second and last response') -``` -## streaming responses - -Mock a streaming response by registering a generator response body. - -```python -import requests -from sure import expect -import httpretty - -# mock a streaming response body with a generator -def mock_streaming_tweets(tweets): - from time import sleep - for t in tweets: - sleep(.5) - yield t - -@httpretty.activate -def test_twitter_api_integration(now): - twitter_response_lines = [ - '{"text":"If @BarackObama requests to follow me one more time I\'m calling the police."}\r\n', - '\r\n', - '{"text":"Thanks for all your #FollowMe1D requests Directioners! We\u2019ll be following 10 people throughout the day starting NOW. G ..."}\r\n' - ] - - TWITTER_STREAMING_URL = "https://stream.twitter.com/1/statuses/filter.json" - - # set the body to a generator and set `streaming=True` to mock a streaming response body - httpretty.register_uri(httpretty.POST, TWITTER_STREAMING_URL, - body=mock_streaming_tweets(twitter_response_lines), - streaming=True) - - # taken from the requests docs - # http://docs.python-requests.org/en/latest/user/advanced/#streaming-requests - response = requests.post(TWITTER_STREAMING_URL, data={'track':'requests'}, - auth=('username','password'), prefetch=False) - - #test iterating by line - line_iter = response.iter_lines() - for i in xrange(len(twitter_response_lines)): - expect(line_iter.next().strip()).to.equal(twitter_response_lines[i].strip()) -``` - -## dynamic responses through callbacks - -Set a callback to allow for dynamic responses based on the request. - -```python -import requests -from sure import expect -import httpretty - -@httpretty.activate -def test_response_callbacks(): - - def request_callback(method, uri, headers): - return (200, headers, "The {} response from {}".format(method, uri)) - - httpretty.register_uri( - httpretty.GET, "https://api.yahoo.com/test", - body=request_callback) - - response = requests.get('https://api.yahoo.com/test') - - expect(response.text).to.equal('The GET response from https://api.yahoo.com/test') -``` - -## matching regular expressions - -You can register a -[compiled regex](http://docs.python.org/2/library/re.html#re.compile) -and it will be matched against the requested urls. - -```python -@httpretty.activate -def test_httpretty_should_allow_registering_regexes(): - u"HTTPretty should allow registering regexes" - - httpretty.register_uri( - httpretty.GET, - re.compile("api.yipit.com/v2/deal;brand=(\w+)"), - body="Found brand", - ) - - response = requests.get('https://api.yipit.com/v2/deal;brand=GAP') - expect(response.text).to.equal('Found brand') - expect(httpretty.last_request().method).to.equal('GET') - expect(httpretty.last_request().path).to.equal('/v1/deal;brand=GAP') -``` - -By default, the regexp you register will match the requests without looking at -the querystring. If you want the querystring to be considered, you can set -`match_querystring=True` when calling `register_uri`. - -## expect for a response, and check the request got by the "server" to make sure it was fine. - -```python -import requests -from sure import expect -import httpretty - - -@httpretty.activate -def test_yipit_api_integration(): - httpretty.register_uri(httpretty.POST, "http://api.yipit.com/foo/", - body='{"repositories": ["HTTPretty", "lettuce"]}') - - response = requests.post('http://api.yipit.com/foo', - '{"username": "gabrielfalcao"}', - headers={ - 'content-type': 'text/json', - }) - - expect(response.text).to.equal('{"repositories": ["HTTPretty", "lettuce"]}') - expect(httpretty.last_request().method).to.equal("POST") - expect(httpretty.last_request().headers['content-type']).to.equal('text/json') -``` - -## checking if is enabled - -```python - -httpretty.enable() -httpretty.is_enabled().should.be.true - -httpretty.disable() -httpretty.is_enabled().should.be.false - -``` diff -Nru python-httpretty-0.8.0/docs/intro.md python-httpretty-0.8.0/docs/intro.md --- python-httpretty-0.8.0/docs/intro.md 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/docs/intro.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -# What is HTTPretty ? - -Once upon a time a python developer wanted to use a RESTful api, -everything was fine but until the day he needed to test the code that -hits the RESTful API: what if the API server is down? What if its -content has changed ? - -Don't worry, HTTPretty is here for you: - -```python -import requests -from sure import expect -import httpretty - - -@httpretty.activate -def test_yipit_api_returning_deals(): - httpretty.register_uri(httpretty.GET, "http://api.yipit.com/v1/deals/", - body='[{"title": "Test Deal"}]', - content_type="application/json") - - response = requests.get('http://api.yipit.com/v1/deals/') - - expect(response.json()).to.equal([{"title": "Test Deal"}]) -``` - -## A more technical description - -HTTPretty is a HTTP client mock library for Python 100% inspired on ruby's [FakeWeb](http://fakeweb.rubyforge.org/). -If you come from ruby this would probably sound familiar :smiley: - -## Installing - -Installing httpretty is as easy as: - -```bash -pip install HTTPretty -``` - -# Demo - -## expecting a simple response body - -```python -import requests -import httpretty - -def test_one(): - httpretty.enable() # enable HTTPretty so that it will monkey patch the socket module - httpretty.register_uri(httpretty.GET, "http://yipit.com/", - body="Find the best daily deals") - - response = requests.get('http://yipit.com') - - assert response.text == "Find the best daily deals" - - httpretty.disable() # disable afterwards, so that you will have no problems in code that uses that socket module - httpretty.reset() # reset HTTPretty state (clean up registered urls and request history) -``` - -# Motivation - -When building systems that access external resources such as RESTful -webservices, XMLRPC or even simple HTTP requests, we stumble in the -problem: - - "I'm gonna need to mock all those requests" - -It brings a lot of hassle, you will need to use a generic mocking -tool, mess with scope and so on. - -## The idea behind HTTPretty (how it works) - -HTTPretty [monkey patches](http://en.wikipedia.org/wiki/Monkey_patch) -Python's [socket](http://docs.python.org/library/socket.html) core -module, reimplementing the HTTP protocol, by mocking requests and -responses. - -As for it works in this way, you don't need to worry what http library -you're gonna use. - -HTTPretty will mock the response for you :) *(and also give you the latest requests so that you can check them)* diff -Nru python-httpretty-0.8.0/docs/.markment.yml python-httpretty-0.8.0/docs/.markment.yml --- python-httpretty-0.8.0/docs/.markment.yml 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/docs/.markment.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -project: - name: "HTTPretty" - version: 0.8.0 - description: HTTP request mock tool for python - tagline: Intercept real HTTP calls in python, test your software better. - twitter: gabrielfalcao - twitter_message: Python%20library%20for%20intercepting%20and%20mocking%20HTTP%20calls - google_analytics_code: UA-1277640-14 - github_maintainer: gabrielfalcao - github_maintainer_name: Gabriel Falcão - github_maintainer_url: http://github.com/gabrielfalcao - github_maintainer_gravatar: https://secure.gravatar.com/avatar/3fa0df5c54f5ac0f8652d992d7d24039?s=64 - - github_url: http://github.com/gabrielfalcao/HTTPretty - github_fork_url: https://github.com/gabrielfalcao/HTTPretty/archive/master.tar.gz - tarball_download_url: https://github.com/gabrielfalcao/HTTPretty/archive/master.tar.gz - zipball_download_url: https://github.com/gabrielfalcao/HTTPretty/archive/master.zip - documentation_url: http://falcao.it/HTTPretty - support_url: http://github.com/gabrielfalcao/HTTPretty/issues - logo_url: https://s3-us-west-2.amazonaws.com/s.cdpn.io/18885/httpretty-logo_1.svg - full_index: false -documentation: - index: intro.md diff -Nru python-httpretty-0.8.0/docs/NEWS.md python-httpretty-0.8.0/docs/NEWS.md --- python-httpretty-0.8.0/docs/NEWS.md 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/docs/NEWS.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -# Release Notes - -## 0.8.0 (current) - -Improvements: - -* Refactored `core.py` and increased its unit test coverage to 80%. HTTPretty is slightly more robust now. - -Bug fixes: - -* POST requests being called twice [#100](https://github.com/gabrielfalcao/HTTPretty/pull/100) - -## 0.6.5 - -Applied pull requests: - -* continue on EAGAIN socket errors: [#102](https://github.com/gabrielfalcao/HTTPretty/pull/102) by [kouk](http://github.com/kouk). -* Fix `fake_gethostbyname` for requests 2.0: [#101](https://github.com/gabrielfalcao/HTTPretty/pull/101) by [mgood](http://github.com/mgood) -* Add a way to match the querystrings: [#98](https://github.com/gabrielfalcao/HTTPretty/pull/98) by [ametaireau](http://github.com/ametaireau) -* Use common string case for URIInfo hostname comparison: [#95](https://github.com/gabrielfalcao/HTTPretty/pull/95) by [mikewaters](http://github.com/mikewaters) -* Expose httpretty.reset() to public API: [#91](https://github.com/gabrielfalcao/HTTPretty/pull/91) by [imankulov](http://github.com/imankulov) -* Don't duplicate http ports number: [#89](https://github.com/gabrielfalcao/HTTPretty/pull/89) by [mardiros](http://github.com/mardiros) -* Adding parsed_body parameter to simplify checks: [#88](https://github.com/gabrielfalcao/HTTPretty/pull/88) by [toumorokoshi](http://github.com/toumorokoshi) -* Use the real socket if it's not HTTP: [#87](https://github.com/gabrielfalcao/HTTPretty/pull/87) by [mardiros](http://github.com/mardiros) - -## 0.6.2 - -* Fixing bug of lack of trailing slashes [#73](https://github.com/gabrielfalcao/HTTPretty/issues/73) -* Applied pull requests [#71](https://github.com/gabrielfalcao/HTTPretty/pull/71) and [#72](https://github.com/gabrielfalcao/HTTPretty/pull/72) by @andresriancho -* Keyword arg coercion fix by @dupuy -* @papaeye fixed content-length calculation. - -## 0.6.1 - -* New API, no more camel case and everything is available through a simple import: - -```python -import httpretty - -@httpretty.activate -def test_function(): - # httpretty.register_uri(...) - # make request... - pass -``` - -* Re-organized module into submodules - -## 0.5.14 - -* Delegate calls to other methods on socket - -* [Normalized header](https://github.com/gabrielfalcao/HTTPretty/pull/49) strings - -* Callbacks are [more intelligent now](https://github.com/gabrielfalcao/HTTPretty/pull/47) - -* Normalize urls matching for url quoting - -## 0.5.12 - -* HTTPretty doesn't hang when using other application protocols under - a @httprettified decorated test. - -## 0.5.11 - -* Ability to know whether HTTPretty is or not enabled through `httpretty.is_enabled()` - -## 0.5.10 - -* Support to multiple methods per registered URL. Thanks @hughsaunders - -## 0.5.9 - -* Fixed python 3 support. Thanks @spulec - -## 0.5.8 - -* Support to [register regular expressions to match urls](#matching-regular-expressions) -* [Body callback](#dynamic-responses-through-callbacks) suppport -* Python 3 support diff -Nru python-httpretty-0.8.0/.gitignore python-httpretty-0.8.0/.gitignore --- python-httpretty-0.8.0/.gitignore 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/.gitignore 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -*.pyc -.coverage -docs/_build/ -httpretty.egg-info/ -build/ -dist/ -.DS_Store -*.swp -.#* -#* -.tox/ -_public/ -tests/functional/fixtures/recording-*.json diff -Nru python-httpretty-0.8.0/httpretty.egg-info/dependency_links.txt python-httpretty-0.8.0/httpretty.egg-info/dependency_links.txt --- python-httpretty-0.8.0/httpretty.egg-info/dependency_links.txt 1970-01-01 00:00:00.000000000 +0000 +++ python-httpretty-0.8.0/httpretty.egg-info/dependency_links.txt 2014-02-03 19:17:12.000000000 +0000 @@ -0,0 +1 @@ + diff -Nru python-httpretty-0.8.0/httpretty.egg-info/not-zip-safe python-httpretty-0.8.0/httpretty.egg-info/not-zip-safe --- python-httpretty-0.8.0/httpretty.egg-info/not-zip-safe 1970-01-01 00:00:00.000000000 +0000 +++ python-httpretty-0.8.0/httpretty.egg-info/not-zip-safe 2014-02-03 19:16:40.000000000 +0000 @@ -0,0 +1 @@ + diff -Nru python-httpretty-0.8.0/httpretty.egg-info/PKG-INFO python-httpretty-0.8.0/httpretty.egg-info/PKG-INFO --- python-httpretty-0.8.0/httpretty.egg-info/PKG-INFO 1970-01-01 00:00:00.000000000 +0000 +++ python-httpretty-0.8.0/httpretty.egg-info/PKG-INFO 2014-02-03 19:17:12.000000000 +0000 @@ -0,0 +1,13 @@ +Metadata-Version: 1.1 +Name: httpretty +Version: 0.8.0 +Summary: HTTP client mock for Python +Home-page: http://github.com/gabrielfalcao/httpretty +Author: Gabriel Falcao +Author-email: gabriel@nacaolivre.org +License: MIT +Description: UNKNOWN +Platform: UNKNOWN +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: Topic :: Software Development :: Testing diff -Nru python-httpretty-0.8.0/httpretty.egg-info/requires.txt python-httpretty-0.8.0/httpretty.egg-info/requires.txt --- python-httpretty-0.8.0/httpretty.egg-info/requires.txt 1970-01-01 00:00:00.000000000 +0000 +++ python-httpretty-0.8.0/httpretty.egg-info/requires.txt 2014-02-03 19:17:12.000000000 +0000 @@ -0,0 +1 @@ +urllib3 \ No newline at end of file diff -Nru python-httpretty-0.8.0/httpretty.egg-info/SOURCES.txt python-httpretty-0.8.0/httpretty.egg-info/SOURCES.txt --- python-httpretty-0.8.0/httpretty.egg-info/SOURCES.txt 1970-01-01 00:00:00.000000000 +0000 +++ python-httpretty-0.8.0/httpretty.egg-info/SOURCES.txt 2014-02-03 19:17:12.000000000 +0000 @@ -0,0 +1,38 @@ +COPYING +MANIFEST.in +Makefile +README.md +dev-requirements.txt +requirements.txt +setup.cfg +setup.py +test-requirements.txt +tox.ini +httpretty/__init__.py +httpretty/compat.py +httpretty/core.py +httpretty/errors.py +httpretty/http.py +httpretty/utils.py +httpretty.egg-info/PKG-INFO +httpretty.egg-info/SOURCES.txt +httpretty.egg-info/dependency_links.txt +httpretty.egg-info/not-zip-safe +httpretty.egg-info/requires.txt +httpretty.egg-info/top_level.txt +tests/__init__.py +tests/functional/__init__.py +tests/functional/base.py +tests/functional/test_bypass.py +tests/functional/test_debug.py +tests/functional/test_decorator.py +tests/functional/test_httplib2.py +tests/functional/test_requests.py +tests/functional/test_urllib2.py +tests/functional/testserver.py +tests/functional/fixtures/playback-1.json +tests/unit/__init__.py +tests/unit/test_core.py +tests/unit/test_http.py +tests/unit/test_httpretty.py +tests/unit/test_main.py \ No newline at end of file diff -Nru python-httpretty-0.8.0/httpretty.egg-info/top_level.txt python-httpretty-0.8.0/httpretty.egg-info/top_level.txt --- python-httpretty-0.8.0/httpretty.egg-info/top_level.txt 1970-01-01 00:00:00.000000000 +0000 +++ python-httpretty-0.8.0/httpretty.egg-info/top_level.txt 2014-02-03 19:17:12.000000000 +0000 @@ -0,0 +1 @@ +httpretty diff -Nru python-httpretty-0.8.0/Makefile python-httpretty-0.8.0/Makefile --- python-httpretty-0.8.0/Makefile 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/Makefile 2014-02-03 17:24:56.000000000 +0000 @@ -36,7 +36,6 @@ @python setup.py sdist register upload docs: doctests - @pandoc -o readme.rst README.md @markment -o . -t ./theme --sitemap-for="http://falcao.it/HTTPretty" docs deploy-docs: diff -Nru python-httpretty-0.8.0/.octomarks.yml python-httpretty-0.8.0/.octomarks.yml --- python-httpretty-0.8.0/.octomarks.yml 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/.octomarks.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -author_name: Gabriel Falcão -version: 0.6.0 -documentation_index: docs/main.md \ No newline at end of file diff -Nru python-httpretty-0.8.0/PKG-INFO python-httpretty-0.8.0/PKG-INFO --- python-httpretty-0.8.0/PKG-INFO 1970-01-01 00:00:00.000000000 +0000 +++ python-httpretty-0.8.0/PKG-INFO 2014-02-03 19:17:12.000000000 +0000 @@ -0,0 +1,13 @@ +Metadata-Version: 1.1 +Name: httpretty +Version: 0.8.0 +Summary: HTTP client mock for Python +Home-page: http://github.com/gabrielfalcao/httpretty +Author: Gabriel Falcao +Author-email: gabriel@nacaolivre.org +License: MIT +Description: UNKNOWN +Platform: UNKNOWN +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: Topic :: Software Development :: Testing diff -Nru python-httpretty-0.8.0/readme.rst python-httpretty-0.8.0/readme.rst --- python-httpretty-0.8.0/readme.rst 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/readme.rst 1970-01-01 00:00:00.000000000 +0000 @@ -1,525 +0,0 @@ -HTTPretty 0.8.0 -=============== - -|https://s3-us-west-2.amazonaws.com/s.cdpn.io/18885/httpretty-logo\_1.svg| -|tip for next commit| |Build Status| |instanc.es Badge| -`ChangeLog `__ - -Installing -========== - -Since you are interested in HTTPretty you should also be insterested in -speeding up your build. Replace ``pip`` with -```curdling`` `__ and see your build -running a lot faster. - -You can use curdling to install not only HTTPretty but every dependency -in your project and see the speed gains. - -.. code:: bash - - $ easy_install curdling - $ curd install HTTPretty - -In a nutshell -============= - -Once upon a time a python developer wanted to use a RESTful api, -everything was fine but until the day they needed to test the code that -hits the RESTful API: what if the API server is down? What if its -content has changed ? - -Don't worry, HTTPretty is here for you: - -.. code:: python - - import requests - from sure import expect - import httpretty - - - @httpretty.activate - def test_yipit_api_returning_deals(): - httpretty.register_uri(httpretty.GET, "http://api.yipit.com/v1/deals/", - body='[{"title": "Test Deal"}]', - content_type="application/json") - - response = requests.get('http://api.yipit.com/v1/deals/') - - expect(response.json()).to.equal([{"title": "Test Deal"}]) - -A more technical description -============================ - -HTTPretty is a HTTP client mock library for Python 100% inspired on -ruby's `FakeWeb `__. If you come from -ruby this would probably sound familiar :) - -Usage -===== - -expecting a simple response body --------------------------------- - -.. code:: python - - import requests - import httpretty - - def test_one(): - httpretty.enable() # enable HTTPretty so that it will monkey patch the socket module - httpretty.register_uri(httpretty.GET, "http://yipit.com/", - body="Find the best daily deals") - - response = requests.get('http://yipit.com') - - assert response.text == "Find the best daily deals" - - httpretty.disable() # disable afterwards, so that you will have no problems in code that uses that socket module - httpretty.reset() # reset HTTPretty state (clean up registered urls and request history) - -testing query strings ---------------------- - -.. code:: python - - import requests - from sure import expect - import httpretty - - def test_one(): - httpretty.enable() # enable HTTPretty so that it will monkey patch the socket module - httpretty.register_uri(httpretty.GET, "http://yipit.com/login", - body="Find the best daily deals") - - requests.get('http://yipit.com/login?email=user@github.com&password=foobar123') - expect(httpretty.last_request()).to.have.property("querystring").being.equal({ - "email": "user@github.com", - "password": "foobar123", - }) - - httpretty.disable() # disable afterwards, so that you will have no problems in code that uses that socket module - -ohhhh, really? can that be easier? ----------------------------------- - -**YES** we've got a decorator - -.. code:: python - - import requests - import httpretty - - @httpretty.activate - def test_one(): - httpretty.register_uri(httpretty.GET, "http://yipit.com/", - body="Find the best daily deals") - - response = requests.get('http://yipit.com') - assert response.text == "Find the best daily deals" - -the ``@httpretty.activate`` is a short-hand decorator that wraps the -decorated function with httpretty.enable() and then calls -httpretty.disable() right after. - -mocking the status code ------------------------ - -.. code:: python - - import requests - from sure import expect - import httpretty - - @httpretty.activate - def test_github_access(): - httpretty.register_uri(httpretty.GET, "http://github.com/", - body="here is the mocked body", - status=201) - - response = requests.get('http://github.com') - expect(response.status_code).to.equal(201) - -you can tell HTTPretty to return any HTTP headers you want ----------------------------------------------------------- - -**and all you need is to add keyword args in which the keys are always -lower-cased and with underscores ``_`` instead of dashes ``-``** - -For example, let's say you want to mock that server returns -``content-type``. To do so, use the argument ``content_type``, **all the -keyword args are taken by HTTPretty and transformed in the RFC2616 -equivalent name**. - -.. code:: python - - @httpretty.activate - def test_some_api(): - httpretty.register_uri(httpretty.GET, "http://foo-api.com/gabrielfalcao", - body='{"success": false}', - status=500, - content_type='text/json') - - response = requests.get('http://foo-api.com/gabrielfalcao') - - expect(response.json()).to.equal({'success': False}) - expect(response.status_code).to.equal(500) - -Adding extra headers and forcing headers -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You can pass the ``adding_headers`` argument as a dictionary and your -headers will be -`united `__ to the -existing headers. - -.. code:: python - - @httpretty.activate - def test_some_api(): - httpretty.register_uri(httpretty.GET, "http://foo-api.com/gabrielfalcao", - body='{"success": false}', - status=500, - content_type='text/json', - adding_headers={ - 'X-foo': 'bar' - }) - - response = requests.get('http://foo-api.com/gabrielfalcao') - - expect(response.json()).to.equal({'success': False}) - expect(response.status_code).to.equal(500) - -Although there are some situation where some headers line -``content-length`` will be calculated by HTTPretty based on the -specified fake response body. - -So you might want to *"force"* those headers: - -.. code:: python - - @httpretty.activate - def test_some_api(): - httpretty.register_uri(httpretty.GET, "http://foo-api.com/gabrielfalcao", - body='{"success": false}', - status=500, - content_type='text/json', - forcing_headers={ - 'content-length': '100' - }) - - response = requests.get('http://foo-api.com/gabrielfalcao') - - expect(response.json()).to.equal({'success': False}) - expect(response.status_code).to.equal(500) - -You should, though, be careful with it. The HTTP client is likely to -rely on the content length to know how many bytes of response payload -should be loaded. Forcing a ``content-length`` that is bigger than the -action response body might cause the HTTP client to hang because it is -waiting for data. Read more in the "caveats" session on the bottom. - -rotating responses ------------------- - -Same URL, same request method, the first request return the first -httpretty.Response, all the subsequent ones return the last (status -202). - -Notice that the ``responses`` argument is a list and you can pass as -many responses as you want. - -.. code:: python - - import requests - from sure import expect - - - @httpretty.activate - def test_rotating_responses(): - httpretty.register_uri(httpretty.GET, "http://github.com/gabrielfalcao/httpretty", - responses=[ - httpretty.Response(body="first response", status=201), - httpretty.Response(body='second and last response', status=202), - ]) - - response1 = requests.get('http://github.com/gabrielfalcao/httpretty') - expect(response1.status_code).to.equal(201) - expect(response1.text).to.equal('first response') - - response2 = requests.get('http://github.com/gabrielfalcao/httpretty') - expect(response2.status_code).to.equal(202) - expect(response2.text).to.equal('second and last response') - - response3 = requests.get('http://github.com/gabrielfalcao/httpretty') - - expect(response3.status_code).to.equal(202) - expect(response3.text).to.equal('second and last response') - -streaming responses -------------------- - -Mock a streaming response by registering a generator response body. - -.. code:: python - - import requests - from sure import expect - import httpretty - - # mock a streaming response body with a generator - def mock_streaming_tweets(tweets): - from time import sleep - for t in tweets: - sleep(.5) - yield t - - @httpretty.activate - def test_twitter_api_integration(now): - twitter_response_lines = [ - '{"text":"If @BarackObama requests to follow me one more time I\'m calling the police."}\r\n', - '\r\n', - '{"text":"Thanks for all your #FollowMe1D requests Directioners! We\u2019ll be following 10 people throughout the day starting NOW. G ..."}\r\n' - ] - - TWITTER_STREAMING_URL = "https://stream.twitter.com/1/statuses/filter.json" - - # set the body to a generator and set `streaming=True` to mock a streaming response body - httpretty.register_uri(httpretty.POST, TWITTER_STREAMING_URL, - body=mock_streaming_tweets(twitter_response_lines), - streaming=True) - - # taken from the requests docs - # http://docs.python-requests.org/en/latest/user/advanced/#streaming-requests - response = requests.post(TWITTER_STREAMING_URL, data={'track':'requests'}, - auth=('username','password'), prefetch=False) - - #test iterating by line - line_iter = response.iter_lines() - for i in xrange(len(twitter_response_lines)): - expect(line_iter.next().strip()).to.equal(twitter_response_lines[i].strip()) - -dynamic responses through callbacks ------------------------------------ - -Set a callback to allow for dynamic responses based on the request. - -.. code:: python - - import requests - from sure import expect - import httpretty - - @httpretty.activate - def test_response_callbacks(): - - def request_callback(method, uri, headers): - return (200, headers, "The {} response from {}".format(method, uri)) - - httpretty.register_uri( - httpretty.GET, "https://api.yahoo.com/test", - body=request_callback) - - response = requests.get('https://api.yahoo.com/test') - - expect(response.text).to.equal('The GET response from https://api.yahoo.com/test') - -matching regular expressions ----------------------------- - -You can register a `compiled -regex `__ and it -will be matched against the requested urls. - -.. code:: python - - @httpretty.activate - def test_httpretty_should_allow_registering_regexes(): - u"HTTPretty should allow registering regexes" - - httpretty.register_uri( - httpretty.GET, - re.compile("api.yipit.com/v2/deal;brand=(\w+)"), - body="Found brand", - ) - - response = requests.get('https://api.yipit.com/v2/deal;brand=GAP') - expect(response.text).to.equal('Found brand') - expect(httpretty.last_request().method).to.equal('GET') - expect(httpretty.last_request().path).to.equal('/v1/deal;brand=GAP') - -By default, the regexp you register will match the requests without -looking at the querystring. If you want the querystring to be -considered, you can set ``match_querystring=True`` when calling -``register_uri``. - -expect for a response, and check the request got by the "server" to make sure it was fine. ------------------------------------------------------------------------------------------- - -.. code:: python - - import requests - from sure import expect - import httpretty - - - @httpretty.activate - def test_yipit_api_integration(): - httpretty.register_uri(httpretty.POST, "http://api.yipit.com/foo/", - body='{"repositories": ["HTTPretty", "lettuce"]}') - - response = requests.post('http://api.yipit.com/foo', - '{"username": "gabrielfalcao"}', - headers={ - 'content-type': 'text/json', - }) - - expect(response.text).to.equal('{"repositories": ["HTTPretty", "lettuce"]}') - expect(httpretty.last_request().method).to.equal("POST") - expect(httpretty.last_request().headers['content-type']).to.equal('text/json') - -checking if is enabled ----------------------- - -.. code:: python - - - httpretty.enable() - httpretty.is_enabled().should.be.true - - httpretty.disable() - httpretty.is_enabled().should.be.false - -Motivation -========== - -When building systems that access external resources such as RESTful -webservices, XMLRPC or even simple HTTP requests, we stumble in the -problem: - -:: - - "I'm gonna need to mock all those requests" - -It brings a lot of hassle, you will need to use a generic mocking tool, -mess with scope and so on. - -The idea behind HTTPretty (how it works) ----------------------------------------- - -HTTPretty `monkey patches `__ -Python's `socket `__ core -module, reimplementing the HTTP protocol, by mocking requests and -responses. - -As for it works in this way, you don't need to worry what http library -you're gonna use. - -HTTPretty will mock the response for you :) *(and also give you the -latest requests so that you can check them)* - -Acknowledgements -================ - -caveats with the `requests `__ library ----------------------------------------------------------------------------------- - -``forcing_headers`` + ``Content-Length`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -if you use the ``forcing_headers`` options make sure to add the header -``Content-Length`` otherwise the -`requests `__ will try to -load the response endlessly - -Officially supported libraries -============================== - -Because HTTPretty works in the socket level it should work with any HTTP -client libraries, although it is `battle -tested `__ -against: - -- `requests `__ -- `httplib2 `__ -- `urllib2 `__ - -Hacking on HTTPretty -==================== - -create a virtual env -^^^^^^^^^^^^^^^^^^^^ - -you will need -`virtualenvwrapper `__ - -.. code:: console - - mkvirtualenv --distribute --no-site-packages HTTPretty - -install the dependencies -^^^^^^^^^^^^^^^^^^^^^^^^ - -.. code:: console - - pip install -r requirements.txt - -next steps: -^^^^^^^^^^^ - -1. run the tests with make: - - .. code:: bash - - make unit functional - -2. hack at will -3. commit, push etc -4. send a pull request - -License -======= - -:: - - - Copyright (C) <2011-2013> Gabriel Falcão - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation - files (the "Software"), to deal in the Software without - restriction, including without limitation the rights to use, - copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following - conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - -Main contributors -================= - -There folks made remarkable contributions to HTTPretty: - -- Steve Pulec ~> @spulec -- Hugh Saunders ~> @hughsaunders -- Matt Luongo ~> @mhluongo -- James Rowe ~> @JNRowe - -.. |https://s3-us-west-2.amazonaws.com/s.cdpn.io/18885/httpretty-logo\_1.svg| image:: https://s3-us-west-2.amazonaws.com/s.cdpn.io/18885/httpretty-logo_1.svg -.. |tip for next commit| image:: http://tip4commit.com/projects/133.svg - :target: http://tip4commit.com/projects/133 -.. |Build Status| image:: https://travis-ci.org/gabrielfalcao/HTTPretty.png?branch=master - :target: https://travis-ci.org/gabrielfalcao/HTTPretty -.. |instanc.es Badge| image:: https://instanc.es/bin/gabrielfalcao/HTTPretty.png - :target: http://instanc.es diff -Nru python-httpretty-0.8.0/.release python-httpretty-0.8.0/.release --- python-httpretty-0.8.0/.release 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/.release 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -#!/bin/bash - -current_version=$(cat ./docs/.markment.yml | egrep version | sed 's,^[^:]*: *,,g') -printf "The current version is \033[1;33m$current_version\033[0m, type the new version:\n" -read newversion - - -find_files () { - find . -name '*.py' -or -name '*.yml' -or -name '*.md' -} - -update_files (){ - find_files | xargs gsed -i "s,$current_version,$newversion,g" -} - -printf "\033[A\033[A\rI will make a new commit named \033[1;33m'New release $newversion'\033[0m\n" -printf "Are you sure? [\033[1;32myes\033[0m or \033[1;31mno\033[0m]\n" -read sure - -if [ $sure == "yes" ]; then - update_files - printf "New release: \033[1;32m$newversion\033[0m\n" - git add `find_files` - git commit -am "New release: $newversion" -fi; diff -Nru python-httpretty-0.8.0/setup.cfg python-httpretty-0.8.0/setup.cfg --- python-httpretty-0.8.0/setup.cfg 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/setup.cfg 2014-02-03 19:17:12.000000000 +0000 @@ -1,6 +1,12 @@ [nosetests] -verbosity=2 -with-coverage=1 -cover-erase=1 -cover-package=httpretty -cover-inclusive=1 +verbosity = 2 +with-coverage = 1 +cover-erase = 1 +cover-package = httpretty +cover-inclusive = 1 + +[egg_info] +tag_build = +tag_date = 0 +tag_svn_revision = 0 + diff -Nru python-httpretty-0.8.0/setup.py python-httpretty-0.8.0/setup.py --- python-httpretty-0.8.0/setup.py 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/setup.py 2014-02-03 19:16:40.000000000 +0000 @@ -24,76 +24,35 @@ # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. -import ast -import os -import re -from setuptools import setup, find_packages - - -class VersionFinder(ast.NodeVisitor): - - def __init__(self): - self.version = None - - def visit_Assign(self, node): - if node.targets[0].id == '__version__': - self.version = node.value.s - -def read_version(): - """Read version from httpretty/version.py without loading any files""" - finder = VersionFinder() - finder.visit(ast.parse(local_file('httpretty', '__init__.py'))) - return finder.version +import os +from httpretty import version, HTTPretty +from setuptools import setup -def parse_requirements(path): - """Rudimentary parser for the `requirements.txt` file - - We just want to separate regular packages from links to pass them to the - `install_requires` and `dependency_links` params of the `setup()` - function properly. - """ - try: - requirements = map(str.strip, local_file(path).splitlines()) - except IOError: - raise RuntimeError("Couldn't find the `requirements.txt' file :(") - - links = [] - pkgs = [] - for req in requirements: - if not req: - continue - if 'http:' in req or 'https:' in req: - links.append(req) - name, version = re.findall("\#egg=([^\-]+)-(.+$)", req)[0] - pkgs.append('{0}=={1}'.format(name, version)) - else: - pkgs.append(req) - - return pkgs, links - +HTTPretty.disable() -local_file = lambda *f: \ - open(os.path.join(os.path.dirname(__file__), *f)).read() +HTTPRETTY_PATH = os.path.abspath(os.path.join(__file__, os.pardir)) -install_requires, dependency_links = \ - parse_requirements('requirements.txt') +def parse_requirements(reqs_path): + target_path = os.path.join(HTTPRETTY_PATH, reqs_path) + return [ + line.strip() for line in open(target_path).readlines() + if not line.startswith("#") + ] setup(name='httpretty', - version=read_version(), + version=version, description='HTTP client mock for Python', - long_description=local_file('readme.rst'), author='Gabriel Falcao', author_email='gabriel@nacaolivre.org', url='http://github.com/gabrielfalcao/httpretty', zip_safe=False, - packages=find_packages(exclude=['*tests*']), + packages=['httpretty'], tests_require=parse_requirements('test-requirements.txt'), - install_requires=install_requires, - dependency_links=dependency_links, + install_requires=parse_requirements('requirements.txt'), license='MIT', test_suite='nose.collector', classifiers=["Intended Audience :: Developers", diff -Nru python-httpretty-0.8.0/theme/assets/css/github.css python-httpretty-0.8.0/theme/assets/css/github.css --- python-httpretty-0.8.0/theme/assets/css/github.css 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/theme/assets/css/github.css 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -.hll { background-color: #ffffcc } -.c { color: #999988; font-style: italic } /* Comment */ -.err { color: #a61717; background-color: #e3d2d2 } /* Error */ -.k { color: #000000; font-weight: bold } /* Keyword */ -.o { color: #000000; font-weight: bold } /* Operator */ -.cm { color: #999988; font-style: italic } /* Comment.Multiline */ -.cp { color: #999999; font-weight: bold; font-style: italic } /* Comment.Preproc */ -.c1 { color: #999988; font-style: italic } /* Comment.Single */ -.cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */ -.gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ -.ge { color: #000000; font-style: italic } /* Generic.Emph */ -.gr { color: #aa0000 } /* Generic.Error */ -.gh { color: #999999 } /* Generic.Heading */ -.gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ -.go { color: #888888 } /* Generic.Output */ -.gp { color: #555555 } /* Generic.Prompt */ -.gs { font-weight: bold } /* Generic.Strong */ -.gu { color: #aaaaaa } /* Generic.Subheading */ -.gt { color: #aa0000 } /* Generic.Traceback */ -.kc { color: #000000; font-weight: bold } /* Keyword.Constant */ -.kd { color: #000000; font-weight: bold } /* Keyword.Declaration */ -.kn { color: #000000; font-weight: bold } /* Keyword.Namespace */ -.kp { color: #000000; font-weight: bold } /* Keyword.Pseudo */ -.kr { color: #000000; font-weight: bold } /* Keyword.Reserved */ -.kt { color: #445588; font-weight: bold } /* Keyword.Type */ -.m { color: #009999 } /* Literal.Number */ -.s { color: #d01040 } /* Literal.String */ -.na { color: #008080 } /* Name.Attribute */ -.nb { color: #0086B3 } /* Name.Builtin */ -.nc { color: #445588; font-weight: bold } /* Name.Class */ -.no { color: #008080 } /* Name.Constant */ -.nd { color: #3c5d5d; font-weight: bold } /* Name.Decorator */ -.ni { color: #800080 } /* Name.Entity */ -.ne { color: #990000; font-weight: bold } /* Name.Exception */ -.nf { color: #990000; font-weight: bold } /* Name.Function */ -.nl { color: #990000; font-weight: bold } /* Name.Label */ -.nn { color: #555555 } /* Name.Namespace */ -.nt { color: #000080 } /* Name.Tag */ -.nv { color: #008080 } /* Name.Variable */ -.ow { color: #000000; font-weight: bold } /* Operator.Word */ -.w { color: #bbbbbb } /* Text.Whitespace */ -.mf { color: #009999 } /* Literal.Number.Float */ -.mh { color: #009999 } /* Literal.Number.Hex */ -.mi { color: #009999 } /* Literal.Number.Integer */ -.mo { color: #009999 } /* Literal.Number.Oct */ -.sb { color: #d01040 } /* Literal.String.Backtick */ -.sc { color: #d01040 } /* Literal.String.Char */ -.sd { color: #d01040 } /* Literal.String.Doc */ -.s2 { color: #d01040 } /* Literal.String.Double */ -.se { color: #d01040 } /* Literal.String.Escape */ -.sh { color: #d01040 } /* Literal.String.Heredoc */ -.si { color: #d01040 } /* Literal.String.Interpol */ -.sx { color: #d01040 } /* Literal.String.Other */ -.sr { color: #009926 } /* Literal.String.Regex */ -.s1 { color: #d01040 } /* Literal.String.Single */ -.ss { color: #990073 } /* Literal.String.Symbol */ -.bp { color: #999999 } /* Name.Builtin.Pseudo */ -.vc { color: #008080 } /* Name.Variable.Class */ -.vg { color: #008080 } /* Name.Variable.Global */ -.vi { color: #008080 } /* Name.Variable.Instance */ -.il { color: #009999 } /* Literal.Number.Integer.Long */ diff -Nru python-httpretty-0.8.0/theme/assets/css/style.css python-httpretty-0.8.0/theme/assets/css/style.css --- python-httpretty-0.8.0/theme/assets/css/style.css 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/theme/assets/css/style.css 1970-01-01 00:00:00.000000000 +0000 @@ -1,68 +0,0 @@ -html { - background: #faf9f4; -} -body { - background: transparent; - top: 0; - bottom: 0; - left: 0; - right: 0; -} -.logo { - padding-top: 30px; -} -.logo h1 { - font-size: 60px; -} -.logo h1 small { - font-size: 30px; -} -*, -body, -html, -.article, -h1, -h2, -h3, -h4, -h5, -h6, -p, -div, -span, -strong, -a, -li, -ul, -ol, -nav { - font-family: "Montserrat"; -} -.httpretty-navbar .uk-navbar-brand { - font-size: 28px; - padding-top: 4px; -} -.httpretty-navbar .uk-navbar-brand small { - font-size: 14px; -} -a.uk-button-primary { - color: white; -} - - -a { - color: #3973A6; -} - -code, code *, pre, pre * { - font-family: "Monaco", "Inconsolata", "monospace"; -} - -div.highlight pre { - box-shadow: inset 0px 1px 2px 1px rgba(80, 80, 80, .15); -} - - -#docs-body { - padding-top: 120px; -} diff -Nru python-httpretty-0.8.0/theme/assets/js/prefixfree.min.js python-httpretty-0.8.0/theme/assets/js/prefixfree.min.js --- python-httpretty-0.8.0/theme/assets/js/prefixfree.min.js 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/theme/assets/js/prefixfree.min.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,492 +0,0 @@ -/** - * StyleFix 1.0.3 & PrefixFree 1.0.7 - * @author Lea Verou - * MIT license - */ - -(function(){ - -if(!window.addEventListener) { - return; -} - -var self = window.StyleFix = { - link: function(link) { - try { - // Ignore stylesheets with data-noprefix attribute as well as alternate stylesheets - if(link.rel !== 'stylesheet' || link.hasAttribute('data-noprefix')) { - return; - } - } - catch(e) { - return; - } - - var url = link.href || link.getAttribute('data-href'), - base = url.replace(/[^\/]+$/, ''), - base_scheme = (/^[a-z]{3,10}:/.exec(base) || [''])[0], - base_domain = (/^[a-z]{3,10}:\/\/[^\/]+/.exec(base) || [''])[0], - base_query = /^([^?]*)\??/.exec(url)[1], - parent = link.parentNode, - xhr = new XMLHttpRequest(), - process; - - xhr.onreadystatechange = function() { - if(xhr.readyState === 4) { - process(); - } - }; - - process = function() { - var css = xhr.responseText; - - if(css && link.parentNode && (!xhr.status || xhr.status < 400 || xhr.status > 600)) { - css = self.fix(css, true, link); - - // Convert relative URLs to absolute, if needed - if(base) { - css = css.replace(/url\(\s*?((?:"|')?)(.+?)\1\s*?\)/gi, function($0, quote, url) { - if(/^([a-z]{3,10}:|#)/i.test(url)) { // Absolute & or hash-relative - return $0; - } - else if(/^\/\//.test(url)) { // Scheme-relative - // May contain sequences like /../ and /./ but those DO work - return 'url("' + base_scheme + url + '")'; - } - else if(/^\//.test(url)) { // Domain-relative - return 'url("' + base_domain + url + '")'; - } - else if(/^\?/.test(url)) { // Query-relative - return 'url("' + base_query + url + '")'; - } - else { - // Path-relative - return 'url("' + base + url + '")'; - } - }); - - // behavior URLs shoudn’t be converted (Issue #19) - // base should be escaped before added to RegExp (Issue #81) - var escaped_base = base.replace(/([\\\^\$*+[\]?{}.=!:(|)])/g,"\\$1"); - css = css.replace(RegExp('\\b(behavior:\\s*?url\\(\'?"?)' + escaped_base, 'gi'), '$1'); - } - - var style = document.createElement('style'); - style.textContent = css; - style.media = link.media; - style.disabled = link.disabled; - style.setAttribute('data-href', link.getAttribute('href')); - - parent.insertBefore(style, link); - parent.removeChild(link); - - style.media = link.media; // Duplicate is intentional. See issue #31 - } - }; - - try { - xhr.open('GET', url); - xhr.send(null); - } catch (e) { - // Fallback to XDomainRequest if available - if (typeof XDomainRequest != "undefined") { - xhr = new XDomainRequest(); - xhr.onerror = xhr.onprogress = function() {}; - xhr.onload = process; - xhr.open("GET", url); - xhr.send(null); - } - } - - link.setAttribute('data-inprogress', ''); - }, - - styleElement: function(style) { - if (style.hasAttribute('data-noprefix')) { - return; - } - var disabled = style.disabled; - - style.textContent = self.fix(style.textContent, true, style); - - style.disabled = disabled; - }, - - styleAttribute: function(element) { - var css = element.getAttribute('style'); - - css = self.fix(css, false, element); - - element.setAttribute('style', css); - }, - - process: function() { - // Linked stylesheets - $('link[rel="stylesheet"]:not([data-inprogress])').forEach(StyleFix.link); - - // Inline stylesheets - $('style').forEach(StyleFix.styleElement); - - // Inline styles - $('[style]').forEach(StyleFix.styleAttribute); - }, - - register: function(fixer, index) { - (self.fixers = self.fixers || []) - .splice(index === undefined? self.fixers.length : index, 0, fixer); - }, - - fix: function(css, raw, element) { - for(var i=0; i -1) { - // Gradients are supported with a prefix, convert angles to legacy - css = css.replace(/(\s|:|,)(repeating-)?linear-gradient\(\s*(-?\d*\.?\d*)deg/ig, function ($0, delim, repeating, deg) { - return delim + (repeating || '') + 'linear-gradient(' + (90-deg) + 'deg'; - }); - } - - css = fix('functions', '(\\s|:|,)', '\\s*\\(', '$1' + prefix + '$2(', css); - css = fix('keywords', '(\\s|:)', '(\\s|;|\\}|$)', '$1' + prefix + '$2$3', css); - css = fix('properties', '(^|\\{|\\s|;)', '\\s*:', '$1' + prefix + '$2:', css); - - // Prefix properties *inside* values (issue #8) - if (self.properties.length) { - var regex = RegExp('\\b(' + self.properties.join('|') + ')(?!:)', 'gi'); - - css = fix('valueProperties', '\\b', ':(.+?);', function($0) { - return $0.replace(regex, prefix + "$1") - }, css); - } - - if(raw) { - css = fix('selectors', '', '\\b', self.prefixSelector, css); - css = fix('atrules', '@', '\\b', '@' + prefix + '$1', css); - } - - // Fix double prefixing - css = css.replace(RegExp('-' + prefix, 'g'), '-'); - - // Prefix wildcard - css = css.replace(/-\*-(?=[a-z]+)/gi, self.prefix); - - return css; - }, - - property: function(property) { - return (self.properties.indexOf(property)? self.prefix : '') + property; - }, - - value: function(value, property) { - value = fix('functions', '(^|\\s|,)', '\\s*\\(', '$1' + self.prefix + '$2(', value); - value = fix('keywords', '(^|\\s)', '(\\s|$)', '$1' + self.prefix + '$2$3', value); - - // TODO properties inside values - - return value; - }, - - // Warning: Prefixes no matter what, even if the selector is supported prefix-less - prefixSelector: function(selector) { - return selector.replace(/^:{1,2}/, function($0) { return $0 + self.prefix }) - }, - - // Warning: Prefixes no matter what, even if the property is supported prefix-less - prefixProperty: function(property, camelCase) { - var prefixed = self.prefix + property; - - return camelCase? StyleFix.camelCase(prefixed) : prefixed; - } -}; - -/************************************** - * Properties - **************************************/ -(function() { - var prefixes = {}, - properties = [], - shorthands = {}, - style = getComputedStyle(document.documentElement, null), - dummy = document.createElement('div').style; - - // Why are we doing this instead of iterating over properties in a .style object? Cause Webkit won't iterate over those. - var iterate = function(property) { - if(property.charAt(0) === '-') { - properties.push(property); - - var parts = property.split('-'), - prefix = parts[1]; - - // Count prefix uses - prefixes[prefix] = ++prefixes[prefix] || 1; - - // This helps determining shorthands - while(parts.length > 3) { - parts.pop(); - - var shorthand = parts.join('-'); - - if(supported(shorthand) && properties.indexOf(shorthand) === -1) { - properties.push(shorthand); - } - } - } - }, - supported = function(property) { - return StyleFix.camelCase(property) in dummy; - } - - // Some browsers have numerical indices for the properties, some don't - if(style.length > 0) { - for(var i=0; i \ No newline at end of file diff -Nru python-httpretty-0.8.0/theme/assets/README.txt python-httpretty-0.8.0/theme/assets/README.txt --- python-httpretty-0.8.0/theme/assets/README.txt 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/theme/assets/README.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -A Pen created at CodePen.io. You can find this one at http://codepen.io/gabrielfalcao/pen/Esdub. - - \ No newline at end of file diff -Nru python-httpretty-0.8.0/theme/content.html python-httpretty-0.8.0/theme/content.html --- python-httpretty-0.8.0/theme/content.html 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/theme/content.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ - {% macro render_menu_item(header, relative_path) -%} - {% if header['level'] < 3 and header['level'] > 1 %} -
  • {{ header.text|safe }}
  • - {% endif %} - {% if 'child' in header %} - {% for child in header['child'] %} - {{ render_menu_item(child, relative_path) }} - {% endfor %} - {% endif %} - {%- endmacro %} - -
    -
    -
    -
    - {{ project.name }} -

    {{ project.name }} v{{ project.version }}

    -

    - - - -

    - Table of Contents -
    - -
      - {% for page in master_index %} - {% if page.relative_path.endswith("intro.md") %} -
    • {{ page.indexes[0].text }}
    • - {% for item in page.indexes %} - {{ render_menu_item(item, page.relative_path) }} - {% endfor %} - {% endif %} - {% endfor %} - {% for page in master_index %} - {% if page.relative_path.endswith("docs.md") %} -
    • {{ page.indexes[0].text }}
    • - {% for item in page.indexes %} - {{ render_menu_item(item, page.relative_path) }} - {% endfor %} - {% endif %} - {% endfor %} - {% for page in master_index %} - {% if page.relative_path.endswith("about.md") %} -
    • {{ page.indexes[0].text }}
    • - {% for item in page.indexes %} - {{ render_menu_item(item, page.relative_path) }} - {% endfor %} - {% endif %} - {% endfor %} - {% for page in master_index %} - {% if page.relative_path.endswith("contributing.md") %} -
    • {{ page.indexes[0].text }}
    • - {% for item in page.indexes %} - {{ render_menu_item(item, page.relative_path) }} - {% endfor %} - {% endif %} - {% endfor %} - {% for page in master_index %} - {% if page.relative_path.endswith("NEWS.md") %} -
    • {{ page.indexes[0].text }}
    • - {% for item in page.indexes %} - {{ render_menu_item(item, page.relative_path) }} - {% endfor %} - {% endif %} - {% endfor %} -
    -
    -
    -
    -

    {{ project.name }}

    -

    {{ project.description }}

    -
    - {{ documentation|safe }} -
    -
    - -
    -
    - diff -Nru python-httpretty-0.8.0/theme/index.html python-httpretty-0.8.0/theme/index.html --- python-httpretty-0.8.0/theme/index.html 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/theme/index.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ - - - - - {{ project.name }} by {{ project.github_maintainer }} - - - - - - - - - - - - - {% include "./content.html" %} - - - - - - \ No newline at end of file diff -Nru python-httpretty-0.8.0/theme/logo.html python-httpretty-0.8.0/theme/logo.html --- python-httpretty-0.8.0/theme/logo.html 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/theme/logo.html 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -
    - -

    {{ project.tagline }}

    -

    Check the documentation

    -
      -
    • - -
    • -
    • -
    • -
    -
      -
    • - -
    • -
    • - -
    • -
    -
    diff -Nru python-httpretty-0.8.0/theme/markment.yml python-httpretty-0.8.0/theme/markment.yml --- python-httpretty-0.8.0/theme/markment.yml 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/theme/markment.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ -index_template: index.html -assets_path: assets -author: - name: Gabriel Falcao - username: gabrielfalcao - website: http://falcao.it - -github_url: https://github.com/gabrielfalcao/markment diff -Nru python-httpretty-0.8.0/.travis.yml python-httpretty-0.8.0/.travis.yml --- python-httpretty-0.8.0/.travis.yml 2014-02-03 19:30:40.000000000 +0000 +++ python-httpretty-0.8.0/.travis.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -language: python -python: - - "2.6" - - "2.7" - - "3.3" - - "pypy" - -matrix: - allow_failures: - - python: "3.3" - - python: "pypy" - -env: - - TEST_TYPE=unit - - TEST_TYPE=functional - -install: - - pip install -r requirements.txt -r test-requirements.txt - -script: - - make $TEST_TYPE