21
21
import emission .storage .decorations .analysis_timeseries_queries as esda
22
22
import emission .core .wrapper .user as ecwu
23
23
import emission .net .api .stats as enac
24
+ import emission .pipeline .intake_stage as epi
24
25
25
26
# Test imports
26
27
import emission .tests .common as etc
@@ -32,16 +33,18 @@ def setUp(self):
32
33
Set up the test environment by loading real example data for both Android and users.
33
34
"""
34
35
# Set up the real example data with entries
35
- etc .setupRealExample (self , "emission/tests/data/real_examples/shankari_2015-aug-27" )
36
-
36
+ self .testUUID = uuid .uuid4 ()
37
+ with open ("emission/tests/data/real_examples/shankari_2015-aug-21" ) as fp :
38
+ self .entries = json .load (fp , object_hook = esj .wrapped_object_hook )
37
39
# Retrieve the user profile
40
+ etc .setupRealExampleWithEntries (self )
38
41
profile = edb .get_profile_db ().find_one ({"user_id" : self .testUUID })
39
42
if profile is None :
40
43
# Initialize the profile if it does not exist
41
44
edb .get_profile_db ().insert_one ({"user_id" : self .testUUID })
42
45
43
- etc .runIntakePipeline (self .testUUID )
44
-
46
+ # etc.runIntakePipeline(self.testUUID)
47
+ epi . run_intake_pipeline_for_user ( self . testUUID , skip_if_no_new_data = False )
45
48
logging .debug ("UUID = %s" % (self .testUUID ))
46
49
47
50
def tearDown (self ):
@@ -72,7 +75,7 @@ def testGetAndStoreUserStats(self):
72
75
self .assertIn ("pipeline_range" , profile , "User profile should contain 'pipeline_range'." )
73
76
self .assertIn ("last_call_ts" , profile , "User profile should contain 'last_call_ts'." )
74
77
75
- expected_total_trips = 8
78
+ expected_total_trips = 5
76
79
expected_labeled_trips = 0
77
80
78
81
self .assertEqual (profile ["total_trips" ], expected_total_trips ,
@@ -85,8 +88,8 @@ def testGetAndStoreUserStats(self):
85
88
self .assertIn ("start_ts" , pipeline_range , "Pipeline range should contain 'start_ts'." )
86
89
self .assertIn ("end_ts" , pipeline_range , "Pipeline range should contain 'end_ts'." )
87
90
88
- expected_start_ts = 1440688739.672
89
- expected_end_ts = 1440729142.709
91
+ expected_start_ts = 1440168891.095
92
+ expected_end_ts = 1440209488.817
90
93
91
94
self .assertEqual (pipeline_range ["start_ts" ], expected_start_ts ,
92
95
f"Expected start_ts to be { expected_start_ts } , got { pipeline_range ['start_ts' ]} " )
0 commit comments