Skip to content

Commit abcb411

Browse files
authored
re-add missing url method to live_server (#141)
1 parent cfc8047 commit abcb411

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pytest_flask/live_server.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ def _is_ready(self):
6969
sock.close()
7070
return ret
7171

72+
def url(self, url=""):
73+
"""Returns the complete url based on server options."""
74+
return "http://{host!s}:{port!s}{url!s}".format(
75+
host=self.host, port=self.port, url=url
76+
)
77+
7278
def stop(self):
7379
"""Stop application process."""
7480
if self._process:

tests/test_live_server.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class TestLiveServer:
1212
def test_init(self, live_server):
1313
assert live_server.port
1414
assert live_server.host == "localhost"
15+
assert live_server.url() == "http://localhost:{0}".format(live_server.port)
1516

1617
def test_server_is_alive(self, live_server):
1718
assert live_server._process

0 commit comments

Comments
 (0)