@@ -18,9 +18,9 @@ class GetEidAttrValue(common.APITest):
18
18
@classmethod
19
19
def setUpClass (cls ) -> None :
20
20
super ().setUpClass ()
21
- sleep (1 )
21
+ sleep (8 )
22
+ # Data must pass to DB before this request is processed
22
23
cls .get_request ("control/make_snapshots" )
23
- sleep (6 )
24
24
25
25
def test_unknown_entity_type (self ):
26
26
response = self .get_request (
@@ -84,23 +84,9 @@ def get_history_attr_value(self, path: str):
84
84
return result
85
85
86
86
def test_attr_serialization (self ):
87
- for data_type , valid in common .values ["valid" ].items ():
88
- value = valid [- 1 ] # Plain attribute has the latest sent value
89
- with self .subTest (data_type = data_type , v = value ):
90
- path = TESTED_PATH .format (
91
- entity = "test_entity_type" ,
92
- eid = "test_entity_id" ,
93
- attr = f"test_attr_{ data_type } " ,
94
- )
95
- expected = EntityEidAttrValueOrHistory (attr_type = 1 , current_value = value )
96
- result = self .get_entity_data (path , EntityEidAttrValueOrHistory )
97
- if expected != result :
98
- print (f"Expected: { expected } " )
99
- print (f"Result: { result } " )
100
- self .assertEqual (expected , result )
101
-
87
+ # Test first with `query_expected_value` to await snapshot
102
88
for data_type , valid in common .observation_values ["valid" ].items ():
103
- with self .subTest (data_type = data_type , v = value ):
89
+ with self .subTest (data_type = data_type , v = valid ):
104
90
path = TESTED_PATH .format (
105
91
entity = "test_entity_type" ,
106
92
eid = "test_entity_id" ,
@@ -115,3 +101,18 @@ def test_attr_serialization(self):
115
101
attempts = 50 ,
116
102
delay_s = 0.2 ,
117
103
)
104
+
105
+ for data_type , valid in common .values ["valid" ].items ():
106
+ value = valid [- 1 ] # Plain attribute has the latest sent value
107
+ with self .subTest (data_type = data_type , v = value ):
108
+ path = TESTED_PATH .format (
109
+ entity = "test_entity_type" ,
110
+ eid = "test_entity_id" ,
111
+ attr = f"test_attr_{ data_type } " ,
112
+ )
113
+ expected = EntityEidAttrValueOrHistory (attr_type = 1 , current_value = value )
114
+ result = self .get_entity_data (path , EntityEidAttrValueOrHistory )
115
+ if expected != result :
116
+ print (f"Expected: { expected } " )
117
+ print (f"Result: { result } " )
118
+ self .assertEqual (expected , result )
0 commit comments