-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_arcgisext.py
34 lines (28 loc) · 1018 Bytes
/
test_arcgisext.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""Tests for arcgisext
"""
from __future__ import (
unicode_literals, print_function, division, absolute_import)
import unittest
from os.path import exists
from datetime import datetime
import json
from arcgisext import TokenManager
_LOGIN_JSON_PATH = "login-info.json"
class TestArcGisExt(unittest.TestCase):
"""
"""
def test_token(self):
if not exists(_LOGIN_JSON_PATH):
raise FileNotFoundError(_LOGIN_JSON_PATH)
with open(_LOGIN_JSON_PATH) as json_file:
login_info = json.load(json_file)
username = login_info["username"]
password = login_info["password"]
token_manager = TokenManager(
username, password, 60, "https://wsdot.maps.arcgis.com")
self.assertGreaterEqual(
token_manager._expires, datetime.now(),
"Token expiration should be later than the current time.")
self.assertTrue(isinstance(token_manager._token, str))
if __name__ == '__main__':
unittest.main()