mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-18 18:56:28 +00:00
test index json
This commit is contained in:
parent
85980038de
commit
90bb4cf587
53
integration/test_web.py
Normal file
53
integration/test_web.py
Normal file
@ -0,0 +1,53 @@
|
||||
import sys
|
||||
import time
|
||||
import shutil
|
||||
from os import mkdir, unlink, utime
|
||||
from os.path import join, exists, getmtime
|
||||
|
||||
import util
|
||||
|
||||
import pytest_twisted
|
||||
|
||||
|
||||
def test_index(alice):
|
||||
"""
|
||||
we can download the index file
|
||||
"""
|
||||
util.web_get(alice._node_dir, "")
|
||||
# ...and json mode is valid json
|
||||
json.loads(util.web_get(alice._node_dir, "?t=json"))
|
||||
|
||||
|
||||
def test_upload_download(alice):
|
||||
"""
|
||||
upload a file, then download it via readcap
|
||||
"""
|
||||
|
||||
# XXX FIXME why?
|
||||
print("waiting for ready..")
|
||||
time.sleep(10)
|
||||
|
||||
FILE_CONTENTS = "some contents"
|
||||
|
||||
readcap = util.web_post(
|
||||
alice._node_dir,
|
||||
"uri",
|
||||
data={
|
||||
"t": "upload",
|
||||
"format": "mdmf",
|
||||
},
|
||||
files={
|
||||
"file": FILE_CONTENTS,
|
||||
},
|
||||
)
|
||||
readcap = readcap.strip()
|
||||
print("readcap '{}'".format(readcap))
|
||||
|
||||
data = util.web_get(
|
||||
alice._node_dir, "uri",
|
||||
params={
|
||||
"uri": readcap,
|
||||
"filename": "boom",
|
||||
}
|
||||
)
|
||||
assert data == FILE_CONTENTS
|
Loading…
Reference in New Issue
Block a user