Skip to content

Commit 72d82c3

Browse files
committed
switch test_metrics__return_expected to snapshot
1 parent 9513520 commit 72d82c3

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# HELP pytest_tests_run_total Total number of tests run by pytest
2+
# TYPE pytest_tests_run_total counter
3+
pytest_tests_run_total{test_name="test_metrics__return_expected"} 1.0

tests/integration/core/test_views.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import pytest
33
from rest_framework.test import APIClient
44

5+
from common.test_tools import SnapshotFixture
6+
57

68
def test_liveness_probe__return_expected(
79
client: APIClient,
@@ -15,6 +17,7 @@ def test_liveness_probe__return_expected(
1517
def test_metrics__return_expected(
1618
test_metric: prometheus_client.Counter,
1719
client: APIClient,
20+
snapshot: SnapshotFixture,
1821
) -> None:
1922
# Arrange
2023
test_metric.labels(test_name="test_metrics__return_expected").inc()
@@ -24,13 +27,4 @@ def test_metrics__return_expected(
2427

2528
# Assert
2629
assert response.status_code == 200
27-
assert response.content == (
28-
"\n".join(
29-
[
30-
"# HELP pytest_tests_run_total Total number of tests run by pytest",
31-
"# TYPE pytest_tests_run_total counter",
32-
'pytest_tests_run_total{test_name="test_metrics__return_expected"} 1.0',
33-
"",
34-
]
35-
).encode()
36-
)
30+
assert response.content.decode() == snapshot()

0 commit comments

Comments
 (0)