fewer magic numbers (and a fix to upload encoding)
This commit is contained in:
parent
20f907f5d3
commit
0f6d6659e9
|
@ -77,19 +77,18 @@ def test_put(alice):
|
|||
use PUT to create a file
|
||||
"""
|
||||
|
||||
FILE_CONTENTS = u"added via PUT"
|
||||
FILE_CONTENTS = b"added via PUT" * 20
|
||||
|
||||
resp = requests.put(
|
||||
util.node_url(alice.node_dir, u"uri"),
|
||||
files={
|
||||
u"file": FILE_CONTENTS,
|
||||
},
|
||||
data=FILE_CONTENTS,
|
||||
)
|
||||
cap = allmydata.uri.from_string(resp.text.strip().encode('ascii'))
|
||||
cfg = alice.get_config()
|
||||
assert isinstance(cap, allmydata.uri.CHKFileURI)
|
||||
assert cap.size == 153
|
||||
assert cap.total_shares == 4
|
||||
assert cap.needed_shares == 2
|
||||
assert cap.size == len(FILE_CONTENTS)
|
||||
assert cap.total_shares == int(cfg.get_config("client", "shares.total"))
|
||||
assert cap.needed_shares == int(cfg.get_config("client", "shares.needed"))
|
||||
|
||||
|
||||
def test_helper_status(storage_nodes):
|
||||
|
|
|
@ -17,6 +17,7 @@ from allmydata.util.configutil import (
|
|||
set_config,
|
||||
write_config,
|
||||
)
|
||||
from allmydata import client
|
||||
|
||||
import pytest_twisted
|
||||
|
||||
|
@ -164,6 +165,12 @@ class TahoeProcess(object):
|
|||
def node_dir(self):
|
||||
return self._node_dir
|
||||
|
||||
def get_config(self):
|
||||
return client.read_config(
|
||||
self._node_dir,
|
||||
u"portnum",
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return "<TahoeProcess in '{}'>".format(self._node_dir)
|
||||
|
||||
|
|
Loading…
Reference in New Issue