test_query_valid.py 559 Bytes
Newer Older
Ismail Moumni's avatar
Ismail Moumni committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/ python3
# Authors : Julien DAVID & Ismail MOUMNI
import sys
import os
import pytest
import json
sys.path.append(os.path.realpath('../softwares/server'))
from softwares.server import server as serv # noqa E402


data_test1 = '{"parameters":""}'
data_test2 = '{"Ref":"Parameters"}'


data_load = json.loads(data_test1)
data_load2 = json.loads(data_test2)


def test_query_valid(data: dict):
    var = serv.query_valid(data_load)
    assert var


def test_bad_missing():
    with pytest.raises(Exception):
        assert serv.query_valid(data_load2)