Esempio n. 1
0
 def test_session_id_returns_cookie_auth_method(self):
     """If an existing session exists, use that session in cookie auth."""
     m = service._detect_auth_method(None,
                                     None,
                                     "session",
                                     "key",
                                     None,
                                     None,
                                     None)
     self.assertEqual(m, 'cookie')
Esempio n. 2
0
 def test_credentials_returns_cookie_auth_method(self):
     """If no method is specified, use cookie auth."""
     m = service._detect_auth_method("u", "pass", None, "key", None, None,
                                     None)
     self.assertEqual(m, 'cookie')
Esempio n. 3
0
 def test_secret_returns_oauth2_resource_owner_auth_method(self):
     """If we specify a client_id and secret then use OAuth2."""
     m = service._detect_auth_method(None, None, None, "key", "client_id",
                                     "secret", None)
     self.assertEqual(m, 'oauth2-resourceowner')
Esempio n. 4
0
 def test_secret_returns_oauth2_auth_method(self):
     m = service._detect_auth_method(None, None, None, "key", "secret",
                                     None)
     self.assertEqual(m, 'oauth2')
Esempio n. 5
0
 def test_no_apikey_raises_auth_method(self):
     with self.assertRaises(errors.ClientError):
         service._detect_auth_method(None, None, None, None, None, None)
Esempio n. 6
0
 def test_credentials_returns_cookie_auth_method(self):
     m = service._detect_auth_method("u", "pass", None, "key", None, None)
     self.assertEqual(m, 'cookie')
Esempio n. 7
0
 def test_session_id_returns_cookie_auth_method(self):
     m = service._detect_auth_method(None, None, "session", "key", None,
                                     None)
     self.assertEqual(m, 'cookie')
Esempio n. 8
0
 def test_no_apikey_raises_auth_method(self):
     with self.assertRaises(errors.ClientError):
         service._detect_auth_method(None, None, None, None, None, None)
Esempio n. 9
0
 def test_token_returns_oauth2_auth_method(self):
     m = service._detect_auth_method(None, None, None, "key", None, "token")
     self.assertEqual(m, 'oauth2')
Esempio n. 10
0
 def test_secret_returns_oauth2_auth_method(self):
     m = service._detect_auth_method(None, None, None, "key", "secret", None)
     self.assertEqual(m, 'oauth2')
Esempio n. 11
0
 def test_session_id_returns_cookie_auth_method(self):
     m = service._detect_auth_method(None, None, "session", "key", None, None)
     self.assertEqual(m, 'cookie')
Esempio n. 12
0
 def test_credentials_returns_cookie_auth_method(self):
     m = service._detect_auth_method("u", "pass", None, "key", None, None)
     self.assertEqual(m, 'cookie')
Esempio n. 13
0
 def test_token_returns_oauth2_auth_method(self):
     m = service._detect_auth_method(None, None, None, "key", None, "token")
     self.assertEqual(m, 'oauth2')
Esempio n. 14
0
 def test_secret_returns_oauth2_resource_owner_auth_method(self):
     m = service._detect_auth_method(None, None, None, "key", "client_id",
                                     "secret", None)
     self.assertEqual(m, 'oauth2')