@@ -94,16 +94,18 @@ def test_report(self):
9494 "y_var" : "gross_floor_area" ,
9595 }
9696 response = self .client .get (url , data )
97-
98- assert response . json ()[ "data" ][ "property_counts" ] = = [
99- {"yr_e" : "2016" , "num_properties" : 5 , "num_properties_w-data" : 5 },
100- {"yr_e" : "2015" , "num_properties" : 5 , "num_properties_w-data" : 5 },
97+ property_counts = response . json ()[ "data" ][ "property_counts" ]
98+ expected = [
99+ {"yr_e" : "2016" , "num_properties" : 5 , "num_properties_w-data" : 5 , "cycle" : self . cycle_2 . name },
100+ {"yr_e" : "2015" , "num_properties" : 5 , "num_properties_w-data" : 5 , "cycle" : self . cycle . name },
101101 ]
102+ self .assertEqual (property_counts , expected )
102103
103104 data ["cycle_ids" ] = [self .cycle .id ]
104105 response = self .client .get (url , data )
105-
106- assert response .json ()["data" ]["property_counts" ] == [{"yr_e" : "2015" , "num_properties" : 5 , "num_properties_w-data" : 5 }]
106+ property_counts = response .json ()["data" ]["property_counts" ]
107+ expected = [{"yr_e" : "2015" , "num_properties" : 5 , "num_properties_w-data" : 5 , "cycle" : self .cycle .name }]
108+ self .assertEqual (property_counts , expected )
107109
108110 def test_report_aggregated (self ):
109111 url = reverse ("api:v3:organizations-report-aggregated" , args = [self .org .pk ])
@@ -114,15 +116,18 @@ def test_report_aggregated(self):
114116 "access_level_instance_id" : self .org .root .id ,
115117 }
116118 response = self .client .get (url , data )
117- assert response .json ()["aggregated_data" ]["property_counts" ] == [
118- {"yr_e" : "2016" , "num_properties" : 5 , "num_properties_w-data" : 5 },
119- {"yr_e" : "2015" , "num_properties" : 5 , "num_properties_w-data" : 5 },
119+ property_counts = response .json ()["aggregated_data" ]["property_counts" ]
120+ expected = [
121+ {"yr_e" : "2016" , "num_properties" : 5 , "num_properties_w-data" : 5 , "cycle" : self .cycle_2 .name },
122+ {"yr_e" : "2015" , "num_properties" : 5 , "num_properties_w-data" : 5 , "cycle" : self .cycle .name },
120123 ]
124+ self .assertEqual (property_counts , expected )
121125
122126 data ["cycle_ids" ] = [self .cycle .id ]
123127 response = self .client .get (url , data )
124-
125- assert response .json ()["aggregated_data" ]["property_counts" ] == [{"yr_e" : "2015" , "num_properties" : 5 , "num_properties_w-data" : 5 }]
128+ property_counts = response .json ()["aggregated_data" ]["property_counts" ]
129+ expected = [{"yr_e" : "2015" , "num_properties" : 5 , "num_properties_w-data" : 5 , "cycle" : self .cycle .name }]
130+ self .assertEqual (property_counts , expected )
126131
127132 def test_report_aggregated_count (self ):
128133 url = reverse ("api:v3:organizations-report-aggregated" , args = [self .org .pk ])
@@ -133,15 +138,18 @@ def test_report_aggregated_count(self):
133138 "access_level_instance_id" : self .org .root .id ,
134139 }
135140 response = self .client .get (url , data )
136- assert response .json ()["aggregated_data" ]["property_counts" ] == [
137- {"yr_e" : "2016" , "num_properties" : 5 , "num_properties_w-data" : 5 },
138- {"yr_e" : "2015" , "num_properties" : 5 , "num_properties_w-data" : 5 },
141+ property_counts = response .json ()["aggregated_data" ]["property_counts" ]
142+ expected = [
143+ {"yr_e" : "2016" , "num_properties" : 5 , "num_properties_w-data" : 5 , "cycle" : self .cycle_2 .name },
144+ {"yr_e" : "2015" , "num_properties" : 5 , "num_properties_w-data" : 5 , "cycle" : self .cycle .name },
139145 ]
146+ self .assertEqual (property_counts , expected )
140147
141148 data ["cycle_ids" ] = [self .cycle .id ]
142149 response = self .client .get (url , data )
143-
144- assert response .json ()["aggregated_data" ]["property_counts" ] == [{"yr_e" : "2015" , "num_properties" : 5 , "num_properties_w-data" : 5 }]
150+ property_counts = response .json ()["aggregated_data" ]["property_counts" ]
151+ expected = [{"yr_e" : "2015" , "num_properties" : 5 , "num_properties_w-data" : 5 , "cycle" : self .cycle .name }]
152+ self .assertEqual (property_counts , expected )
145153
146154 def test_report_missing_arg (self ):
147155 url = reverse ("api:v3:organizations-report-aggregated" , args = [self .org .pk ])
0 commit comments