Created
August 21, 2011 14:52
Revisions
-
jarus created this gist
Aug 21, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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')