コード例 #1
0
ファイル: test_db.py プロジェクト: fluidinfo/fom
 def testLoginLogout(self):
     """
     Make sure login and logout functions set things up correctly
     """
     db = FluidDB(TEST_INSTANCE)
     # start from a blank slate
     self.assertFalse('Authorization' in db.headers)
     # Login
     db.login(TEST_USER, TEST_PASSWORD)
     userpass = TEST_USER + ':' + TEST_PASSWORD
     auth = 'Basic ' + userpass.encode('base64').strip()
     self.assertEquals(db.headers['Authorization'], auth)
     # Logout
     db.logout()
     self.assertFalse('Authorization' in db.headers)
コード例 #2
0
ファイル: test_db.py プロジェクト: ingmar/fom
 def testLoginLogout(self):
     """
     Make sure login and logout functions set things up correctly
     """
     db = FluidDB(TEST_INSTANCE)
     # start from a blank slate
     self.assertFalse('Authorization' in db.headers)
     # Login
     db.login(TEST_USER, TEST_PASSWORD)
     userpass = TEST_USER + ':' + TEST_PASSWORD
     auth = 'Basic ' + userpass.encode('base64').strip()
     self.assertEquals(db.headers['Authorization'], auth)
     # Logout
     db.logout()
     self.assertFalse('Authorization' in db.headers)
コード例 #3
0
ファイル: test_db.py プロジェクト: fluidinfo/fom
 def testLoginLogoutOAuth2(self):
     """
     Make sure login and logout functions set things up correctly
     when we use OAuth2.
     """
     token = 'kajfjowijmssafuwoisflsjlfsoieuossfh'
     db = FluidDB(TEST_INSTANCE)
     # start from a blank slate
     self.assertFalse('Authorization' in db.headers)
     self.assertFalse('X-FluidDB-Access-Token' in db.headers)
     # Login
     db.login_oauth2(token)
     self.assertEquals(db.headers['Authorization'], 'oauth2')
     self.assertEquals(db.headers['X-FluidDB-Access-Token'], token)
     # Logout
     db.logout()
     self.assertFalse('Authorization' in db.headers)
     self.assertFalse('X-FluidDB-Access-Token' in db.headers)
コード例 #4
0
ファイル: test_db.py プロジェクト: ingmar/fom
 def testLoginLogoutOAuth2(self):
     """
     Make sure login and logout functions set things up correctly
     when we use OAuth2.
     """
     token = 'kajfjowijmssafuwoisflsjlfsoieuossfh'
     db = FluidDB(TEST_INSTANCE)
     # start from a blank slate
     self.assertFalse('Authorization' in db.headers)
     self.assertFalse('X-FluidDB-Access-Token' in db.headers)
     # Login
     db.login_oauth2(token)
     self.assertEquals(db.headers['Authorization'], 'oauth2')
     self.assertEquals(db.headers['X-FluidDB-Access-Token'], token)
     # Logout
     db.logout()
     self.assertFalse('Authorization' in db.headers)
     self.assertFalse('X-FluidDB-Access-Token' in db.headers)