diff --git a/integration_tests/conftest.py b/integration_tests/conftest.py index 5483be2e9..595bc60e3 100644 --- a/integration_tests/conftest.py +++ b/integration_tests/conftest.py @@ -18,6 +18,17 @@ def session(): del os.environ["ROBYN_URL"] +@pytest.fixture +def default_session(): + subprocess.call(["yes | freeport 5000"], shell=True) + 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(5) + yield + process.terminate() + + @pytest.fixture def global_session(): os.environ["ROBYN_URL"] = "0.0.0.0" diff --git a/integration_tests/test_base_url.py b/integration_tests/test_base_url.py index be6c629e3..2697d565b 100644 --- a/integration_tests/test_base_url.py +++ b/integration_tests/test_base_url.py @@ -1,6 +1,12 @@ import requests +def test_default_url_index_request(default_session): + BASE_URL = "http://127.0.0.1:5000" + res = requests.get(f"{BASE_URL}") + assert(res.status_code == 200) + + def test_local_index_request(session): BASE_URL = "http://127.0.0.1:5000" res = requests.get(f"{BASE_URL}") diff --git a/robyn/__init__.py b/robyn/__init__.py index a1998b80f..b2ef394ac 100644 --- a/robyn/__init__.py +++ b/robyn/__init__.py @@ -157,7 +157,7 @@ def startup_handler(self, handler): def shutdown_handler(self, handler): self._add_event_handler(Events.SHUTDOWN, handler) - def start(self, url="128.0.0.1", port=5000): + def start(self, url="127.0.0.1", port=5000): """ [Starts the server]