-
Notifications
You must be signed in to change notification settings - Fork 12
/
test_atlasapi.py
64 lines (42 loc) · 1.54 KB
/
test_atlasapi.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import pytest
from atlasapi.api import AtlasAPI
from atlasapi.errors import AtlasInitialisationError
def test_atlas_organization():
api = AtlasAPI()
org = api.get_organization("599eeced9f78f769464d175c")
assert org is not None
assert org.id == "599eeced9f78f769464d175c"
def test_atlas_organisations():
api = AtlasAPI()
orgs = api.get_organisations(limi=200)
list_of_orgs = list(orgs)
assert list_of_orgs is not None
assert len(list_of_orgs) == 200
with pytest.raises(AtlasInitialisationError):
api = AtlasAPI(page_size=0)
with pytest.raises(AtlasInitialisationError):
api = AtlasAPI(page_size=501)
with pytest.raises(AtlasInitialisationError):
api = AtlasAPI(page_size=-1)
def test_atlas_project():
api = AtlasAPI()
project = api.get_project("5a141a774e65811a132a8010")
assert project is not None
assert project.id == "5a141a774e65811a132a8010"
def test_atlas_projects():
api = AtlasAPI()
projects = api.get_projects("5a141a774e65811a132a8010")
assert projects is not None
assert list(projects) is not None
assert len(list(projects)) >= 0
def test_atlas_cluster():
api = AtlasAPI()
cluster = api.get_cluster("5a141a774e65811a132a8010", "Foodapedia")
assert cluster is not None
assert cluster.name == "Foodapedia"
def test_atlas_clusters():
api = AtlasAPI()
clusters = api.get_clusters("5a141a774e65811a132a8010")
assert clusters is not None
assert list(clusters) is not None
assert len(list(clusters)) >= 0