Skip to content

Instantly share code, notes, and snippets.

@jarus
Created August 21, 2011 14:52

Revisions

  1. jarus created this gist Aug 21, 2011.
    22 changes: 22 additions & 0 deletions test.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    import base64
    from myapplication import app

    class MyTestCase(unittest.TestCase):
    def setUp(self):
    self.app = app.test_client()

    def tearDown(self):
    pass

    def open_with_auth(self, url, method, username, password):
    return self.app.open(url,
    method=method,
    headers={
    'Authorization': 'Basic ' + base64.b64encode(username + \
    ":" + password)
    }
    )

    def test_login(self):
    res = self.open_with_auth('/user/login', 'GET', 'username',
    'password')