Add specific coverge testcase

This commit is contained in:
Colin Goutte 2021-09-27 16:05:43 +02:00
parent ee9e555e21
commit bd7ad825fe
1 changed files with 19 additions and 3 deletions

View File

@ -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