Skip to content

Commit

Permalink
[#59157] server: tests: test-groups: import boilerplate test setup fr…
Browse files Browse the repository at this point in the history
…om common module
  • Loading branch information
msobkowski committed Jun 7, 2024
1 parent 7815b7a commit 62b0eed
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions server/tests/test-groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,13 @@
import subprocess
import pytest

from common import (GROUPS_ENDPOINT, process)

SERVER = "http://127.0.0.1:5000/"
GROUPS_ENDPOINT = f"{SERVER}/api/v1/groups"
DUMMY_DEVICE_ID = 1
DBPATH = "test-db.db"
GROUP_DEFAULT_PRIORITY = 25

@pytest.fixture()
def process():
if os.path.isfile(DBPATH):
os.remove(DBPATH)

print("Starting server..")
process = subprocess.Popen(["python3", "-m", "rdfm_mgmt_server", "--debug", "--no-ssl", "--no-api-auth", "--test-mocks", "--database", f"sqlite:///{DBPATH}"])
time.sleep(5)

yield process

print("Shutting down server..")
process.kill()


def test_groups(process: subprocess.Popen):
def test_groups(process):
# Fetching all groups, assumes that no groups were already created
# i.e empty database
resp = requests.get(GROUPS_ENDPOINT)
Expand Down

0 comments on commit 62b0eed

Please sign in to comment.