-
Notifications
You must be signed in to change notification settings - Fork 178
/
Copy pathtest_server.py
34 lines (28 loc) · 982 Bytes
/
test_server.py
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
27
28
29
30
31
32
33
34
import pytest
import responses
@responses.activate
def test_server_properties(nessus):
responses.add(responses.GET,
'https://localhost:8834/server/properties',
json={'id': 1}
)
resp = nessus.server.properties()
assert resp == {'id': 1}
@responses.activate
def test_server_status(nessus):
responses.add(responses.GET,
'https://localhost:8834/server/status',
json={'status': 'loading', 'progress': 50}
)
resp = nessus.server.status()
assert resp == {'status': 'loading', 'progress': 50}
@responses.activate
def test_server_restart(nessus):
responses.add(responses.GET,
'https://localhost:8834/server/restart'
)
nessus.server.restart(reason='Example Reason',
soft=True,
unlink=True,
when_idle=True
)