From e3c81d54fda48567eae739167c6f94cd11795050 Mon Sep 17 00:00:00 2001 From: "Emmanuel I. Obi" Date: Thu, 4 Jan 2024 13:27:04 -0600 Subject: [PATCH] adds Report test --- tests/pokedex/db/test_models.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/pokedex/db/test_models.py diff --git a/tests/pokedex/db/test_models.py b/tests/pokedex/db/test_models.py new file mode 100644 index 0000000..49f3c8f --- /dev/null +++ b/tests/pokedex/db/test_models.py @@ -0,0 +1,21 @@ +import json +from unittest import TestCase + +from pokedex.db.models import Report + + +class TestReport(TestCase): + + def test_report_representation(self): + results = { + "https://pokeapi.co/api/v2/pokemon/1/": True, + "https://pokeapi.co/api/v2/pokemon/2/": True, + "https://pokeapi.co/api/v2/pokemon/3/": False, + } + report = Report(persisted=results) + expected_report = json.dumps( + {"persisted": results, "count": len(results)}, + indent=4 + ) + + assert str(report) == expected_report