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


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)
Ismail Moumni's avatar
edit    
Ismail Moumni committed
21
    assert var is True
Ismail Moumni's avatar
Ismail Moumni committed
22
23
24
25
26


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