-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_api.py
More file actions
35 lines (24 loc) · 886 Bytes
/
test_api.py
File metadata and controls
35 lines (24 loc) · 886 Bytes
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
#!/usr/bin/env python
import pytest
from api import API
def test_create():
api = API('http://pythoncanarias.es/api/v1')
assert api.base_url == 'http://pythoncanarias.es/api/v1'
assert len(api.path) == 0
def test_create_and_compose():
api = API('http://pythoncanarias.es/api/v1')
assert isinstance(api, API)
assert isinstance(api.status, API)
assert len(api.status.path) == 1
assert api.status.path == ['status']
assert api.status.get_url() == 'http://pythoncanarias.es/api/v1/status'
def test_single_call():
api = API('http://pythoncanarias.es/api/v1')
assert api.status.get_url() == 'http://pythoncanarias.es/api/v1/status'
def test_call_status():
api = API('http://pythoncanarias.es/api/v1')
status = api.status()
assert status['active']
assert status['version'] >= 1
if __name__ == '__main__':
pytest.main()