Skip to content

Commit

Permalink
Change ssoUrl and esiUrl to sso_url and esi_url
Browse files Browse the repository at this point in the history
because python don't use camelCase for variables
#20
  • Loading branch information
Kyria committed Oct 22, 2017
1 parent d254a61 commit 32d385b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
24 changes: 12 additions & 12 deletions esipy/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ def __init__(
client_id,
secret_key,
app=None,
ssoUrl="https://login.eveonline.com",
esiUrl="https://esi.tech.ccp.is",
sso_url="https://login.eveonline.com",
esi_url="https://esi.tech.ccp.is",
security_name="evesso"):
""" Init the ESI Security Object
:param redirect_uri: the uri to redirect the user after login into SSO
:param client_id: the OAuth2 client ID
:param secret_key: the OAuth2 secret key
:param ssoUrl: the default sso URL used when no "app" is provided
:param esiUrl: the default esi URL used for verify endpoint
:param sso_url: the default sso URL used when no "app" is provided
:param esi_url: the default esi URL used for verify endpoint
:param app: (optionnal) the pyswagger app object
:param security_name: (optionnal) the name of the object holding the
informations in the securityDefinitions, used to check authed endpoint
Expand All @@ -46,7 +46,7 @@ def __init__(
self.client_id = client_id
self.secret_key = secret_key

# we provide app object, so we don't use ssoUrl
# we provide app object, so we don't use sso_url
if app is not None:
# check if the security_name exists in the securityDefinition
security = app.root.securityDefinitions.get(security_name, None)
Expand All @@ -69,17 +69,17 @@ def __init__(

# no app object is provided, so we use direct URLs
else:
if ssoUrl is None or ssoUrl == "":
raise AttributeError("ssoUrl cannot be None or empty "
if sso_url is None or sso_url == "":
raise AttributeError("sso_url cannot be None or empty "
"without app parameter")

self.oauth_authorize = '%s/oauth/authorize' % ssoUrl
self.oauth_token = '%s/oauth/token' % ssoUrl
self.oauth_authorize = '%s/oauth/authorize' % sso_url
self.oauth_token = '%s/oauth/token' % sso_url

# use ESI url for verify, since it's better for caching
if esiUrl is None or esiUrl == "":
raise AttributeError("esiUrl cannot be None or empty")
self.oauth_verify = '%s/verify/' % esiUrl
if esi_url is None or esi_url == "":
raise AttributeError("esi_url cannot be None or empty")
self.oauth_verify = '%s/verify/' % esi_url

# session request stuff
self._session = Session()
Expand Down
8 changes: 4 additions & 4 deletions test/test_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_esisecurity_init_with_app(self):
redirect_uri=TestEsiSecurity.CALLBACK_URI,
client_id=TestEsiSecurity.CLIENT_ID,
secret_key=TestEsiSecurity.SECRET_KEY,
esiUrl=""
esi_url=""
)

self.assertEqual(
Expand Down Expand Up @@ -105,15 +105,15 @@ def test_esisecurity_other_init(self):
redirect_uri=TestEsiSecurity.CALLBACK_URI,
client_id=TestEsiSecurity.CLIENT_ID,
secret_key=TestEsiSecurity.SECRET_KEY,
ssoUrl=""
sso_url=""
)

security = EsiSecurity(
redirect_uri=TestEsiSecurity.CALLBACK_URI,
client_id=TestEsiSecurity.CLIENT_ID,
secret_key=TestEsiSecurity.SECRET_KEY,
ssoUrl='foo.com',
esiUrl='bar.baz'
sso_url='foo.com',
esi_url='bar.baz'
)

self.assertEqual(
Expand Down

0 comments on commit 32d385b

Please sign in to comment.