Skip to content

Commit

Permalink
fix(ot&e): url updated for OT&E environment
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiSchwarz-cnic committed Mar 23, 2022
1 parent 72be15f commit 6bdebc8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 6 additions & 3 deletions hexonet/apiconnector/apiclient.py
Expand Up @@ -21,13 +21,14 @@
rtm = RTM()

ISPAPI_CONNECTION_URL_PROXY = "http://127.0.0.1/api/call.cgi"
ISPAPI_CONNECTION_URL = "https://api.ispapi.net/api/call.cgi"
ISPAPI_CONNECTION_URL_LIVE = "https://api.ispapi.net/api/call.cgi"
ISPAPI_CONNECTION_URL_OTE = "https://api-ote.ispapi.net/api/call.cgi"


class APIClient(object):
def __init__(self):
# API connection url
self.setURL(ISPAPI_CONNECTION_URL)
self.setURL(ISPAPI_CONNECTION_URL_LIVE)
# Object covering API connection data
self.__socketConfig = SocketConfig()
# activity flag for debug mode
Expand Down Expand Up @@ -384,20 +385,22 @@ def useDefaultConnectionSetup(self):
"""
Activate Default Connection Setup (which is the default anyways)
"""
self.setURL(ISPAPI_CONNECTION_URL)
self.setURL(ISPAPI_CONNECTION_URL_LIVE)
return self

def useOTESystem(self):
"""
Set OT&E System for API communication
"""
self.setURL(ISPAPI_CONNECTION_URL_OTE)
self.__socketConfig.setSystemEntity("1234")
return self

def useLIVESystem(self):
"""
Set LIVE System for API communication (this is the default setting)
"""
self.setURL(ISPAPI_CONNECTION_URL_LIVE)
self.__socketConfig.setSystemEntity("54cd")
return self

Expand Down
8 changes: 4 additions & 4 deletions tests/test_apiclient.py
@@ -1,6 +1,6 @@
from hexonet.apiconnector.apiclient import (
APIClient as AC,
ISPAPI_CONNECTION_URL,
ISPAPI_CONNECTION_URL_LIVE,
ISPAPI_CONNECTION_URL_PROXY,
)
from hexonet.apiconnector.response import Response as R
Expand Down Expand Up @@ -114,7 +114,7 @@ def test_apiclientmethods():
cl.setSession("")

# #.getURL()
assert cl.getURL() == ISPAPI_CONNECTION_URL
assert cl.getURL() == ISPAPI_CONNECTION_URL_LIVE

# #.getUserAgent()
pid = "PYTHON-SDK"
Expand Down Expand Up @@ -163,7 +163,7 @@ def test_apiclientmethods():
tmp = ISPAPI_CONNECTION_URL_PROXY
url = cl.setURL(tmp).getURL()
assert url is tmp
cl.setURL(ISPAPI_CONNECTION_URL)
cl.setURL(ISPAPI_CONNECTION_URL_LIVE)

# #.setOTP()
# [otp set]
Expand Down Expand Up @@ -458,4 +458,4 @@ def test_apiclientmethods():

# #.useDefaultConnectionSetup
cl.useDefaultConnectionSetup()
assert cl.getURL() == ISPAPI_CONNECTION_URL
assert cl.getURL() == ISPAPI_CONNECTION_URL_LIVE

0 comments on commit 6bdebc8

Please sign in to comment.