-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconftest.py
More file actions
40 lines (29 loc) · 832 Bytes
/
conftest.py
File metadata and controls
40 lines (29 loc) · 832 Bytes
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
35
36
37
38
39
40
import pytest
import json
from src import create_app
from src.library.vehicle import vehicle
def get_connected_app():
return create_app(
{
"APIKEY": "jif3fioj32ifj3oi2jf2",
"MAVLINK_SETUP_DEBUG": "production",
"IP_ADDRESS": "164.2.0.3",
"PORT": 5760,
}
)
@pytest.fixture(scope="session")
def app():
# set up
app_connected = get_connected_app()
test_client = app_connected.test_client()
setup_connection(test_client)
yield test_client # stop to run tests
# clean up
vehicle.disconnect()
def setup_connection(app):
response = app.post(
"/aircraft/connect",
data=json.dumps({"ipAddress": "acom-sitl", "port": 5760}),
content_type="application/json",
)
assert response.status_code == 201