-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest_wave_query_class.py
More file actions
87 lines (65 loc) · 1.77 KB
/
test_wave_query_class.py
File metadata and controls
87 lines (65 loc) · 1.77 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
"""
This file is part of pysofar: A client for interfacing with Sofar Oceans Spotter API
Contents: Tests for device endpoints
Copyright (C) 2019
Sofar Ocean Technologies
Authors: Mike Sosa
"""
from pysofar.sofar import WaveDataQuery
st = '2019-05-02'
end = '2019-05-10'
q = WaveDataQuery('SPOT-0350', limit=100, start_date=st, end_date=end)
q.wind(True)
def test_query_execute():
# basic query
# returned earliest data first
response = q.execute()
assert response is not None
assert isinstance(response, dict)
assert 'waves' in response
assert 'wind' in response
def test_query_no_dates():
# resturned latest data first
q.limit(10)
q.clear_start_date()
q.clear_end_date()
response = q.execute()
assert response is not None
assert isinstance(response, dict)
assert 'waves' in response
assert 'wind' in response
def test_query_no_start():
# resturned
q.limit(10)
q.clear_start_date()
q.set_end_date(end)
response = q.execute()
assert response is not None
assert isinstance(response, dict)
assert 'waves' in response
assert 'wind' in response
def test_query_no_end():
# returned
q.limit(10)
q.clear_end_date()
q.set_start_date(st)
response = q.execute()
assert response is not None
assert isinstance(response, dict)
assert 'waves' in response
assert 'wind' in response
# TODO: need to get a viable spotter for testing
# def test_query_surface_temp():
# q.surface_temp(True)
# q.limit = 10
#
# q.clear_end_date()
# response = q.execute()
# q.set_start_date(st)
#
# assert response is not None
# assert isinstance(response, dict)
#
# assert 'waves' in response
# assert 'wind' in response
# assert 'surfaceTemp' in response