Fix error message testing
This commit is contained in:
parent
7c6702057d
commit
5178a288ca
3 changed files with 18 additions and 19 deletions
|
@ -32,8 +32,7 @@ class TestContentUser:
|
|||
valid_signers = site.content_manager.getValidSigners("data/users/1J6UrZMkarjVg5ax9W4qThir3BFUikbW6C/content.json", user_content)
|
||||
assert '1TeSTvb4w2PWE81S2rEELgmX2GCCExQGT' in valid_signers # The site address
|
||||
assert '14wgQ4VDDZNoRMFF4yCDuTrBSHmYhL3bet' in valid_signers # Admin user defined in data/users/content.json
|
||||
assert not '1J6UrZMkarjVg5ax9W4qThir3BFUikbW6C' in valid_signers # The user itself
|
||||
|
||||
assert '1J6UrZMkarjVg5ax9W4qThir3BFUikbW6C' not in valid_signers # The user itself
|
||||
|
||||
def testRules(self, site):
|
||||
# We going to manipulate it this test rules based on data/users/content.json
|
||||
|
@ -104,7 +103,7 @@ class TestContentUser:
|
|||
data = StringIO(json.dumps(data_dict))
|
||||
with pytest.raises(VerifyError) as err:
|
||||
site.content_manager.verifyFile(user_inner_path, data, ignore_same=False)
|
||||
assert "Content too large" in str(err)
|
||||
assert "Include too large" in str(err)
|
||||
|
||||
# Give more space based on address
|
||||
users_content["user_contents"]["permissions"]["1CjfbrbwtP8Y2QjPy12vpTATkUT7oSiPQ9"] = {"max_size": 20000}
|
||||
|
@ -182,7 +181,7 @@ class TestContentUser:
|
|||
data = StringIO(json.dumps(data_dict))
|
||||
with pytest.raises(VerifyError) as err:
|
||||
site.content_manager.verifyFile(user_inner_path, data, ignore_same=False)
|
||||
assert "Includes not allowed" in err
|
||||
assert "Includes not allowed" in str(err)
|
||||
|
||||
def testCert(self, site):
|
||||
# user_addr = "1J6UrZMkarjVg5ax9W4qThir3BFUikbW6C"
|
||||
|
@ -239,7 +238,7 @@ class TestContentUser:
|
|||
"data/users/1J6UrZMkarjVg5ax9W4qThir3BFUikbW6C/content.json",
|
||||
StringIO(json.dumps(signed_content)), ignore_same=False
|
||||
)
|
||||
assert "Valid sings: 0" in str(err)
|
||||
assert "Valid signs: 0/1" in str(err)
|
||||
del site.content_manager.contents["data/users/content.json"]["user_contents"]["permissions"][cert_user_id] # Reset
|
||||
|
||||
# Test invalid cert
|
||||
|
|
|
@ -37,7 +37,7 @@ class TestSite:
|
|||
|
||||
# Changes in non-data files should be overwritten
|
||||
new_site.storage.write("index.html", "this will be overwritten")
|
||||
assert new_site.storage.read("index.html"), "this will be overwritten"
|
||||
assert new_site.storage.read("index.html") == "this will be overwritten"
|
||||
|
||||
# Changes in data file should be kept after re-cloning
|
||||
changed_contentjson = new_site.storage.loadJson("content.json")
|
||||
|
|
Loading…
Reference in a new issue