Skip to content

Commit d72e5f4

Browse files
test setup
1 parent 41b8eae commit d72e5f4

File tree

8 files changed

+31
-23
lines changed

8 files changed

+31
-23
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ __pycache__
99

1010
# IDEs
1111
.vscode
12+
13+
# Virtual Environments
14+
env

geoengine/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from .auth import Session
2+
from .lib import initialize, Accessor
+3-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
from geoengine.lib import Accessor
2-
from typing import UUID
31
import requests as req
2+
from uuid import UUID
43

54

65
class Session:
@@ -12,7 +11,7 @@ def __init__(self, id: UUID) -> None:
1211
self.id = id
1312

1413

15-
def initialize(server_url: str) -> Accessor:
14+
def initialize_session(server_url: str) -> Session:
1615
'''
1716
Initialize communication between this library and a Geo Engine instance
1817
'''
@@ -22,6 +21,4 @@ def initialize(server_url: str) -> Accessor:
2221
session = req.post(f'{server_url}/anonymous').json()
2322
session_id = session['id']
2423

25-
session = Session(session_id)
26-
27-
Accessor(session)
24+
Session(session_id)

src/geoengine/lib.py geoengine/lib.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
from geoengine.auth import Session
2+
from geoengine.auth import Session, initialize_session
33
from typing import Any
44
import geopandas as gpd
55
import requests as req
@@ -13,3 +13,11 @@ def __init__(self, session: Session) -> None:
1313

1414
def get_features(self, workflow_id: Any, bbox: Any) -> gpd.GeoDataFrame:
1515
pass
16+
17+
18+
def initialize(server_url: str) -> Accessor:
19+
'''
20+
Initialize communication between this library and a Geo Engine instance
21+
'''
22+
23+
Accessor(initialize_session(server_url))

setup.cfg

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ classifiers =
1515

1616
[options]
1717
package_dir =
18-
= src
1918
packages = find:
2019
python_requires = >=3.6
2120
install_requires =
@@ -24,4 +23,4 @@ install_requires =
2423
owslib
2524

2625
[options.packages.find]
27-
where = src
26+
where = .

src/geoengine/__init__.py

Whitespace-only changes.

tests/test.py

-14
This file was deleted.

tests/test_auth.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import unittest
2+
3+
import geoengine as ge
4+
5+
6+
class AuthTests(unittest.TestCase):
7+
8+
def test_initialize(self):
9+
ge.initialize("http://peter.geoengine.io:6060/")
10+
11+
12+
if __name__ == '__main__':
13+
unittest.main()

0 commit comments

Comments
 (0)