Skip to content

Commit

Permalink
Fix testing suite
Browse files Browse the repository at this point in the history
  • Loading branch information
sansyrox committed Oct 25, 2021
1 parent dfb1f3c commit 2523539
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 56 deletions.
21 changes: 0 additions & 21 deletions Dockerfile

This file was deleted.

14 changes: 0 additions & 14 deletions docker-compose.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

from robyn import Robyn, static_file, jsonify
import asyncio
import os
import pathlib

app = Robyn(__file__)

Expand All @@ -23,7 +25,10 @@ async def h(request):
@app.get("/test/:id")
async def test(request):
print(request)
return static_file("./index.html")
current_file_path = pathlib.Path(__file__).parent.resolve()
html_file = os.path.join(current_file_path, "index.html")

return static_file(html_file)

@app.get("/jsonify")
async def json_get(request):
Expand Down
17 changes: 17 additions & 0 deletions integration_tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import pytest
import subprocess
import pathlib
import os
import time


@pytest.fixture
def session():
current_file_path = pathlib.Path(__file__).parent.resolve()
base_routes = os.path.join(current_file_path, "./base_routes.py")
process = subprocess.Popen(["python3", base_routes])
time.sleep(1)
yield
process.terminate()


File renamed without changes.
15 changes: 15 additions & 0 deletions integration_tests/test_get_requests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import requests

def test_index_request(session):
res = requests.get("http://127.0.0.1:5000/")
assert(res.status_code == 200)

def test_jsonify(session):
r = requests.get("http://127.0.0.1:5000/jsonify")
assert r.json()=={"hello":"world"}
assert r.status_code==200

def test_html(session):
r = requests.get("http://127.0.0.1:5000/test/123")
assert "Hello world. How are you?" in r.text

4 changes: 0 additions & 4 deletions test_python/Dockerfile

This file was deleted.

4 changes: 0 additions & 4 deletions test_python/test.sh

This file was deleted.

12 changes: 0 additions & 12 deletions test_python/test_routes.py

This file was deleted.

0 comments on commit 2523539

Please sign in to comment.