mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-13 22:54:27 -04:00
feat: Make input sent via stdin behave the same as using args
This commit is contained in:
parent
b68c13918f
commit
c1d8a74e4f
2 changed files with 24 additions and 7 deletions
|
@ -31,9 +31,15 @@ def test_add_link(tmp_path, process):
|
|||
output_html = f.read()
|
||||
assert "Example Domain" in output_html
|
||||
|
||||
def test_add_link_does_not_support_stdin(tmp_path, process):
|
||||
def test_add_link_support_stdin(tmp_path, process):
|
||||
os.chdir(tmp_path)
|
||||
stdin_process = subprocess.Popen(["archivebox", "add"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
output = stdin_process.communicate(input="example.com".encode())[0]
|
||||
assert "does not accept stdin" in output.decode("utf-8")
|
||||
stdin_process.communicate(input="http://example.com".encode())
|
||||
archived_item_path = list(tmp_path.glob('archive/**/*'))[0]
|
||||
|
||||
assert "index.json" in [x.name for x in archived_item_path.iterdir()]
|
||||
|
||||
with open(archived_item_path / "index.json", "r") as f:
|
||||
output_json = json.load(f)
|
||||
assert "Example Domain" == output_json['history']['title'][0]['output']
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue