Skip to content

Commit

Permalink
a few test fixtures for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth Reitz committed Feb 14, 2011
1 parent fdd54e1 commit 4a3f559
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions test_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,43 @@

import requests

print requests.get('http://kennethreitz.com').headers

class RequestsTestSuite(unittest.TestCase):
"""Requests test cases."""

def setUp(self):
pass

r = requests.Request()
def tearDown(self):
"""Teardown."""
pass

def test_invalid_url(self):
self.assertRaises(ValueError, requests.get, 'hiwpefhipowhefopw')

def test_HTTP_200_OK_GET(self):
r = requests.get('http://google.com')
self.assertEqual(r.status_code, 200)

def test_HTTPS_200_OK_GET(self):
r = requests.get('https://google.com')
self.assertEqual(r.status_code, 200)

def test_HTTP_200_OK_HEAD(self):
r = requests.head('http://google.com')
self.assertEqual(r.status_code, 200)

def test_HTTPS_200_OK_HEAD(self):
r = requests.head('https://google.com')
self.assertEqual(r.status_code, 200)

def test_AUTH_HTTPS_200_OK_GET(self):
auth = requests.AuthObject('requeststest', 'requeststest')
url = 'https://convore.com/api/account/verify.json'
r = requests.get(url, auth=auth)

self.assertEqual(r.status_code, 200)


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

0 comments on commit 4a3f559

Please sign in to comment.