Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added qbay_test/frontend/__init__.py
Empty file.
Empty file.
3 changes: 3 additions & 0 deletions qbay_test/frontend/test_login/test_login.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1
test0@test.com
123456
1 change: 1 addition & 0 deletions qbay_test/frontend/test_login/test_login.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Welcome. Please type 1 to login. Or type 2 register. Or type 3 to exitPlease input emailPlease input password:welcome u0
30 changes: 30 additions & 0 deletions qbay_test/frontend/test_login/test_login.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from os import popen
from pathlib import Path
import subprocess

# get expected input/output file
current_folder = Path(__file__).parent


# read expected in/out
expected_in = open(current_folder.joinpath(
'test_login.in'))
expected_out = open(current_folder.joinpath(
'test_login.out')).read()

print(expected_out)


def test_login():
"""capsys -- object created by pytest to
capture stdout and stderr"""

# pip the input
output = subprocess.run(
['python', '-m', 'qbay'],
stdin=expected_in,
capture_output=True,
).stdout.decode()

print('outputs', output)
assert output.strip() == expected_out.strip()