Skip to content

Commit

Permalink
removed old testcases
Browse files Browse the repository at this point in the history
amithkoujalgi committed Oct 25, 2023

Verified

This commit was signed with the committer’s verified signature.
giuseppe Giuseppe Scrivano
1 parent 5381db2 commit 79321bb
Showing 1 changed file with 3 additions and 45 deletions.
48 changes: 3 additions & 45 deletions sys_stats/tests/test_endpoints.py
Original file line number Diff line number Diff line change
@@ -1,48 +1,6 @@
import multiprocessing
import time

from fastapi.testclient import TestClient
import pytest

from sys_stats.app_server import app

client = TestClient(app)


def test_read_root():
response = client.get("/")
assert response.status_code == 200
assert "Sys Stats" in response.text


def loop_function():
while True:
time.sleep(10)


def _start_new_process_and_return_pid():
new_process = multiprocessing.Process(target=loop_function)
new_process.start()
return new_process.pid


def test_kill_process_by_pid():
pid = _start_new_process_and_return_pid()

response = client.get(f"/kill/{pid}")
assert response.status_code == 200


def test_get_stats():
response = client.get("/stats")
assert response.status_code == 200


# Test the /ports endpoint
def test_get_net_connections():
response = client.get("/ports")
assert response.status_code == 200


if __name__ == "__main__":
pytest.main()
def test_list_processes():
result = True
assert result == True

0 comments on commit 79321bb

Please sign in to comment.