-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest_database_snapshots.py
91 lines (70 loc) · 3.45 KB
/
test_database_snapshots.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
from snapshottest.file import FileSnapshot
import time
# Use the database module from our sister repo. We assume it is installed alongside this repo.
import sys
sys.path.insert(1,"../sathunt-database")
import database
import pytest
# Read config and set up database connection
CONFIG = os.path.abspath("../../trusat-config.yaml")
pytest.db = database.Database(CONFIG)
# START IOD cluster search section
def test_find_cluster_simple(snapshot):
results = pytest.db.findObservationCluster(4376)
snapshot.assert_match(results)
def test_find_cluster_more_data(snapshot):
results = pytest.db.findObservationCluster(28888)
snapshot.assert_match(results)
def test_find_cluster_three(snapshot):
results = pytest.db.findObservationCluster(4376, minObservationCount=3)
snapshot.assert_match(results)
def test_find_cluster_two_observers(snapshot):
results = pytest.db.findObservationCluster(5679, maxMinutesBetweenObservations=90, minObserverCount=2)
snapshot.assert_match(results)
def test_find_cluster_1_to_15_mins_apart(snapshot):
results = pytest.db.findObservationCluster(5679, minSecondsBetweenObservations=60, maxMinutesBetweenObservations=15)
snapshot.assert_match(results)
def test_find_cluster_two_observers_1_to_15_mins_apart(snapshot):
results = pytest.db.findObservationCluster(5679, minSecondsBetweenObservations=60, minObserverCount=2, maxMinutesBetweenObservations=15)
snapshot.assert_match(results)
# END IOD cluster search section
# START other TLE generation queries section
def test_find_objects_with_IODs_but_no_TLEs(snapshot):
results = pytest.db.findObjectsWithIODsButNoTLEs()
snapshot.assert_match(results)
def test_find_objects_with_IODs_newer_than_TLE(snapshot):
results = pytest.db.findObjectsWithIODsNewerThanTLE()
snapshot.assert_match(results)
def test_find_IODs_newer_than_TLEs1(snapshot):
results = pytest.db.findIODsNewerThanPenultimateTLE(5679)
snapshot.assert_match(results)
def test_find_IODs_newer_than_TLEs2(snapshot):
results = pytest.db.findIODsNewerThanPenultimateTLE(11) # Empty result set
snapshot.assert_match(results)
# END other TLE generation queries section
# START user queries section
def test_user_observation_history1(snapshot):
# Leo Barhorst
results = pytest.db.selectUserObservationHistory_JSON('0x5C760Ba09C12E4fd33be49f1B05E6E1e648EB312')
snapshot.assert_match(results)
def test_user_observation_history2(snapshot):
# Ted Molczan
results = pytest.db.selectUserObservationHistory_JSON('0xc3D80057C9f9bE7B34a96Dc2C1f943AEfd36dE78')
snapshot.assert_match(results)
def test_user_objects_observed1(snapshot):
# Leo Barhorst
results = pytest.db.selectUserObjectsObserved_JSON('0x5C760Ba09C12E4fd33be49f1B05E6E1e648EB312')
snapshot.assert_match(results)
def test_user_objects_observed2(snapshot):
# Ted Molczan
results = pytest.db.selectUserObjectsObserved_JSON('0xc3D80057C9f9bE7B34a96Dc2C1f943AEfd36dE78')
snapshot.assert_match(results)
def test_user_sightings1(snapshot):
# Leo Barhorst; sightings from two separate stations
results = pytest.db.selectObjectUserSightings_JSON(7816, '0x5C760Ba09C12E4fd33be49f1B05E6E1e648EB312')
snapshot.assert_match(results)
def test_user_sightings2(snapshot):
# Ted Molczan; sightings from two separate stations
results = pytest.db.selectObjectUserSightings_JSON(28888, '0xc3D80057C9f9bE7B34a96Dc2C1f943AEfd36dE78')
snapshot.assert_match(results)
# END user queries section