From bd7ad825fe62ebcd80502422c8d3ea254e9a246d Mon Sep 17 00:00:00 2001 From: Colin Goutte Date: Mon, 27 Sep 2021 16:05:43 +0200 Subject: [PATCH] Add specific coverge testcase --- tests/test_papi.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tests/test_papi.py b/tests/test_papi.py index 3026fb9..8fbd9d4 100644 --- a/tests/test_papi.py +++ b/tests/test_papi.py @@ -1,5 +1,7 @@ +from unittest import TestCase import pytest + from fastapi import FastAPI from fastapi.testclient import TestClient @@ -71,6 +73,20 @@ def test_sample_report(): assert rjson[0] == "-1#Test channel error" -def test_cover(): - with pytest.raises(ValueError): - testutils.probe_sample_body(status="erruer") + +class CodeCoverageTestCase(TestCase): + + """ Get covergage to 100% """ + + def test_cover(self): + with pytest.raises(ValueError): + testutils.probe_sample_body(status="erruer") + + def test_list_unregistred_probe(self): + from random import choices + import string + + id_sonde = "".join(choices(string.ascii_lowercase, k=8)) + r = client.get(f"/sonde/{id_sonde}/rapport") + + assert r.ok