Skip to content

Commit

Permalink
Fix: default url param in app.start (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
sansyrox committed Feb 13, 2022
1 parent 28933da commit 74ae75b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
11 changes: 11 additions & 0 deletions integration_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions integration_tests/test_base_url.py
Original file line number Diff line number Diff line change
@@ -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}")
Expand Down
2 changes: 1 addition & 1 deletion robyn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 74ae75b

Please sign in to comment.