Skip to content

Commit 9589d5d

Browse files
author
Rudolf Offereins
committed
⚡ Update test and example
1 parent 8af79a2 commit 9589d5d

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

examples/control.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
"""Asynchronous Python client for the Geocaching API."""
22
import asyncio
33
from geocachingapi import GeocachingApi
4+
from geocachingapi.models import GeocachingApiEnvironment
45

56
async def main():
67
"""Show example of using the Geocaching API"""
7-
async with GeocachingApi() as api:
8-
print("test")
8+
async with GeocachingApi(token="<insert your token here>", environment=GeocachingApiEnvironment.Staging) as api:
9+
status = await api.update()
10+
print(status.user.reference_code)
911

1012
if __name__ == "__main__":
1113
loop = asyncio.get_event_loop()
12-
loop.run_until_complete(main())
14+
loop.run_until_complete(main())
15+

tests/test.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
"""Test for Geocaching Api integration."""
2-
from geocachingapi import GeocachingApi, GeocachingStatus
32
import asyncio
43
import logging
4+
from geocachingapi import GeocachingApi, GeocachingStatus
55
from geocachingapi.models import GeocachingApiEnvironment
6-
logging.basicConfig(level=logging.DEBUG)
76
from my_token import TOKEN
7+
logging.basicConfig(level=logging.DEBUG)
88
mylogger = logging.getLogger()
99

1010
async def test():
11+
"""Function to test GeocachingAPI integration"""
1112
status:GeocachingStatus = None
1213
api = GeocachingApi(token=TOKEN, environment=GeocachingApiEnvironment.Staging)
1314
status = await api.update()
1415
print(status.user.reference_code)
15-
assert(status.user.reference_code is not None)
16-
assert(status.user.find_count is not None)
1716
await api.close()
18-
assert(False)
19-
20-
2117
loop = asyncio.get_event_loop()
2218
loop.run_until_complete(test())
2319
loop.close()
24-

0 commit comments

Comments
 (0)