Skip to content

Commit

Permalink
Use MYGEOTAB_SERVER env variable in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aaront committed Feb 13, 2021
1 parent e9c1680 commit 1f5cbd9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,7 @@ coverage.xml
docs/_build/

# Mac
.DS_Store
.DS_Store

# Env
.env
6 changes: 3 additions & 3 deletions tests/test_api_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from mygeotab import API, server_call_async
from mygeotab.exceptions import MyGeotabException, TimeoutException
from tests.test_api_call import USERNAME, PASSWORD, DATABASE, TRAILER_NAME
from tests.test_api_call import SERVER, USERNAME, PASSWORD, DATABASE, TRAILER_NAME

USERNAME = os.environ.get("MYGEOTAB_USERNAME_ASYNC", USERNAME)
PASSWORD = os.environ.get("MYGEOTAB_PASSWORD_ASYNC", PASSWORD)
Expand All @@ -19,7 +19,7 @@
@pytest.fixture(scope="session")
def async_populated_api():
if USERNAME and PASSWORD:
session = API(USERNAME, password=PASSWORD, database=DATABASE, server=None)
session = API(USERNAME, password=PASSWORD, database=DATABASE, server=SERVER)
try:
session.authenticate()
except MyGeotabException as exception:
Expand Down Expand Up @@ -109,7 +109,7 @@ async def test_missing_method(self, async_populated_api):

@pytest.mark.asyncio
async def test_call_without_credentials(self):
new_api = API(USERNAME, password=PASSWORD, database=DATABASE, server=None)
new_api = API(USERNAME, password=PASSWORD, database=DATABASE, server=SERVER)
user = await new_api.get_async("User", name="{0}".format(USERNAME))
assert len(user) == 1

Expand Down
5 changes: 3 additions & 2 deletions tests/test_api_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
USERNAME = os.environ.get("MYGEOTAB_USERNAME")
PASSWORD = os.environ.get("MYGEOTAB_PASSWORD")
DATABASE = os.environ.get("MYGEOTAB_DATABASE")
SERVER = os.environ.get("MYGEOTAB_SERVER")
TRAILER_NAME = "mygeotab-python test trailer"

FAKE_USERNAME = "fakeusername"
Expand All @@ -21,7 +22,7 @@
@pytest.fixture(scope="session")
def populated_api():
if USERNAME and PASSWORD:
session = api.API(USERNAME, password=PASSWORD, database=DATABASE, server=None)
session = api.API(USERNAME, password=PASSWORD, database=DATABASE, server=SERVER)
try:
session.authenticate()
except api.MyGeotabException as exception:
Expand Down Expand Up @@ -108,7 +109,7 @@ def test_call_without_credentials(self):
"MYGEOTAB_USERNAME and MYGEOTAB_PASSWORD "
"environment variables being set"
)
new_api = api.API(USERNAME, password=PASSWORD, database=DATABASE, server=None)
new_api = api.API(USERNAME, password=PASSWORD, database=DATABASE, server=SERVER)
user = new_api.get("User", name="{0}".format(USERNAME))
assert len(user) == 1

Expand Down

0 comments on commit 1f5cbd9

Please sign in to comment.