mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-05 11:03:12 +00:00
test(service): startstop
This commit is contained in:
parent
7808033bef
commit
728ea44823
|
@ -61,7 +61,7 @@ allServices {
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def api_start(client, service):
|
def api_start(client, service: Service):
|
||||||
response = client.post(
|
response = client.post(
|
||||||
"/graphql",
|
"/graphql",
|
||||||
json={
|
json={
|
||||||
|
@ -72,7 +72,7 @@ def api_start(client, service):
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
def api_stop(client, service):
|
def api_stop(client, service: Service):
|
||||||
response = client.post(
|
response = client.post(
|
||||||
"/graphql",
|
"/graphql",
|
||||||
json={
|
json={
|
||||||
|
@ -108,3 +108,28 @@ def test_get_services(authorized_client, only_dummy_service):
|
||||||
api_dummy_service = services[0]
|
api_dummy_service = services[0]
|
||||||
assert api_dummy_service["id"] == "testservice"
|
assert api_dummy_service["id"] == "testservice"
|
||||||
assert api_dummy_service["status"] == ServiceStatus.ACTIVE.value
|
assert api_dummy_service["status"] == ServiceStatus.ACTIVE.value
|
||||||
|
|
||||||
|
|
||||||
|
def test_stop_start(authorized_client, only_dummy_service):
|
||||||
|
dummy_service = only_dummy_service
|
||||||
|
|
||||||
|
api_dummy_service = api_all_services(authorized_client)[0]
|
||||||
|
assert api_dummy_service["status"] == ServiceStatus.ACTIVE.value
|
||||||
|
|
||||||
|
# attempting to start an already started service
|
||||||
|
api_start(authorized_client, dummy_service)
|
||||||
|
api_dummy_service = api_all_services(authorized_client)[0]
|
||||||
|
assert api_dummy_service["status"] == ServiceStatus.ACTIVE.value
|
||||||
|
|
||||||
|
api_stop(authorized_client, dummy_service)
|
||||||
|
api_dummy_service = api_all_services(authorized_client)[0]
|
||||||
|
assert api_dummy_service["status"] == ServiceStatus.INACTIVE.value
|
||||||
|
|
||||||
|
# attempting to stop an already stopped service
|
||||||
|
api_stop(authorized_client, dummy_service)
|
||||||
|
api_dummy_service = api_all_services(authorized_client)[0]
|
||||||
|
assert api_dummy_service["status"] == ServiceStatus.INACTIVE.value
|
||||||
|
|
||||||
|
api_start(authorized_client, dummy_service)
|
||||||
|
api_dummy_service = api_all_services(authorized_client)[0]
|
||||||
|
assert api_dummy_service["status"] == ServiceStatus.ACTIVE.value
|
||||||
|
|
Loading…
Reference in a new issue