Sha256: 517b53be00b00da6b865592788c2e3c6462dfa8b9668f801d7abda1d5df56cec

Contents?: true

Size: 603 Bytes

Versions: 3

Compression:

Stored size: 603 Bytes

Contents

import urllib
import unittest

# Pythonistas, set up a global proxy.
# i'm doing it with: 
#
#   $ export http_proxy="http://localhost:9292"
#
# before test run.

class TestGoogle(unittest.TestCase):
    def test_google_unauthorized(self): # passing self, heh.
        params = urllib.urlencode({'mock_text': 'stub_request(:get, "http://google.com?q=moxie").to_return(:status=>401)'})
        urllib.urlopen("http://google.com/__setup__",params).read()
        self.assertRaises(IOError, urllib.urlopen, "http://google.com/?q=moxie") # seriously, python.

if __name__ == '__main__':
    unittest.main()

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
moxy-0.0.3 examples/testing_with_pyunit.py
moxy-0.0.2 examples/testing_with_pyunit.py
moxy-0.0.1 examples/testing_with_pyunit.py