def setUp(self): c = Configuration() self.config = c.load_dict({ "auth_endpoint_uri":"https://www.joshcom.net" }) self.consumer = Consumer("my_key", "my_secret", self.config)
def test_defaults(self): config = Configuration({"auth_mode": "openid"}) self.assertEqual("https://sparkplatform.com/oauth2", config.config["auth_endpoint_uri"]) config = Configuration({"auth_mode": "spark_auth"}) self.assertEqual("https://sparkapi.com/v1/session", config.config["auth_endpoint_uri"])
def setUp(self): c = Configuration() self.config = c.load_dict({ "key":"client_key", "secret":"client_secret", "auth_mode":"oauth2", "auth_endpoint_uri":"https://developers.sparkplatform.com/oauth2?", "api_endpoint_uri": "https://sparkapi.com", "auth_callback_uri":"https://www.joshcom.net/callback" }) self.request = transport.ApiRequest(self.config)
def test_init(self): self.consumer = client.Consumer("my_key", "my_secret") c = Configuration() self.config = c.load_dict({ "key":"client_key", "secret":"client_secret", "auth_mode":"spark_auth", "auth_endpoint_uri":"https://developers.sparkapi.com/v1/session", "api_endpoint_uri": "https://sparkapi.com" }) self.assertRaises(RuntimeError, spark_auth.SparkAuthClient, self.consumer, self.config)
def setUp(self): self.consumer = client.Consumer("my_key", "my_secret", "https://www.joshcom.net") self.token = oauth2.OAuth2Token.parse(TestOauth2Token.example_token()) c = Configuration() self.config = c.load_dict({ "key":"client_key", "secret":"client_secret", "auth_mode":"oauth2", "auth_endpoint_uri":"https://developers.sparkplatform.com/oauth2?", "api_endpoint_uri": "https://sparkapi.com", "auth_callback_uri":"https://www.joshcom.net/callback" }) self.client = oauth2.OAuth2Client(self.consumer,self.config)
def setUp(self): c = Configuration() self.config = c.load_dict({ "key": "client_key", "secret": "client_secret", "auth_mode": "oauth2", "auth_endpoint_uri": "https://www.joshcom.net", "api_endpoint_uri": "https://sparkapi.com", "auth_callback_uri": "https://www.joshcom.net/callback" })
def setUp(self): c = Configuration() self.config = c.load_dict({ "key": "client_key", "secret": "client_secret", "auth_mode": "oauth2", "auth_endpoint_uri": "https://developers.sparkplatform.com/oauth2?", "api_endpoint_uri": "https://sparkapi.com", "auth_callback_uri": "https://www.joshcom.net/callback" }) self.request = transport.ApiRequest(self.config)
def test_load_dict(self): config = Configuration() c = config.load_dict({"auth_mode":"spark_auth"}) self.assertEqual("spark_auth", c["auth_mode"])
def __init__(self, options_dict={}): # TODO: Reconfigre on the fly c = Configuration(options_dict) self.auth = AuthFactory.create(c.config) self.request = ApiRequest(c.config, self.auth)
def test_load_dict(self): config = Configuration() c = config.load_dict({"auth_mode": "spark_auth"}) self.assertEqual("spark_auth", c["auth_mode"])
def test_initial_set_to_defaults(self): config = Configuration() self.assertEqual("hybrid", config.config["auth_mode"])
def setUp(self): c = Configuration() self.config = c.load_dict( {"auth_endpoint_uri": "https://www.joshcom.net"}) self.consumer = Consumer("my_key", "my_secret", self.config)