|
20 | 20 | track_feature_evaluations_by_environment, |
21 | 21 | track_request, |
22 | 22 | ) |
23 | | -from app_analytics.types import FeatureEvaluationKey |
| 23 | +from app_analytics.types import TrackFeatureEvaluationsByEnvironmentData |
24 | 24 | from environments.models import Environment |
25 | 25 |
|
26 | 26 | pytestmark = pytest.mark.skip_if_no_analytics_db |
@@ -177,6 +177,7 @@ def test_track_request__postgres__inserts_expected( |
177 | 177 |
|
178 | 178 |
|
179 | 179 | def test_track_request__influx__calls_expected( |
| 180 | + db: None, |
180 | 181 | settings: SettingsWrapper, |
181 | 182 | mocker: MockerFixture, |
182 | 183 | environment: Environment, |
@@ -210,12 +211,23 @@ def test_track_feature_evaluation(settings: SettingsWrapper) -> None: |
210 | 211 | settings.USE_POSTGRES_FOR_ANALYTICS = True |
211 | 212 | environment_id = 1 |
212 | 213 | feature_evaluations = [ |
213 | | - (FeatureEvaluationKey("feature1", ()), 10), |
214 | | - (FeatureEvaluationKey("feature2", ()), 20), |
| 214 | + TrackFeatureEvaluationsByEnvironmentData( |
| 215 | + feature_name="feature1", |
| 216 | + labels={}, |
| 217 | + evaluation_count=10, |
| 218 | + ), |
| 219 | + TrackFeatureEvaluationsByEnvironmentData( |
| 220 | + feature_name="feature2", |
| 221 | + labels={}, |
| 222 | + evaluation_count=20, |
| 223 | + ), |
215 | 224 | ] |
216 | 225 |
|
217 | 226 | # When |
218 | | - track_feature_evaluations_by_environment(environment_id, feature_evaluations) |
| 227 | + track_feature_evaluations_by_environment( |
| 228 | + environment_id=environment_id, |
| 229 | + feature_evaluations=feature_evaluations, |
| 230 | + ) |
219 | 231 |
|
220 | 232 | # Then |
221 | 233 | assert ( |
@@ -245,12 +257,27 @@ def test_track_feature_evaluation__influx__calls_expected( |
245 | 257 | ) |
246 | 258 | environment_id = 1 |
247 | 259 | feature_evaluations = [ |
248 | | - (FeatureEvaluationKey("feature1", ()), 10), |
249 | | - (FeatureEvaluationKey("feature2", ()), 20), |
| 260 | + ( |
| 261 | + TrackFeatureEvaluationsByEnvironmentData( |
| 262 | + feature_name="feature1", |
| 263 | + labels={}, |
| 264 | + evaluation_count=10, |
| 265 | + ) |
| 266 | + ), |
| 267 | + ( |
| 268 | + TrackFeatureEvaluationsByEnvironmentData( |
| 269 | + feature_name="feature2", |
| 270 | + labels={}, |
| 271 | + evaluation_count=20, |
| 272 | + ) |
| 273 | + ), |
250 | 274 | ] |
251 | 275 |
|
252 | 276 | # When |
253 | | - track_feature_evaluations_by_environment(environment_id, feature_evaluations) |
| 277 | + track_feature_evaluations_by_environment( |
| 278 | + environment_id=environment_id, |
| 279 | + feature_evaluations=feature_evaluations, |
| 280 | + ) |
254 | 281 |
|
255 | 282 | # Then |
256 | 283 | track_feature_evaluation_influxdb_mock.assert_called_once_with( |
|
0 commit comments