Added simplifying comments
This commit is contained in:
@@ -312,31 +312,31 @@ def test_dht(static_peer):
|
||||
))
|
||||
|
||||
# Ensure datum is missing
|
||||
contact = peers[contact_order[0]]
|
||||
contact = peers[contact_order[0]] # 18804
|
||||
with pytest.raises(req.HTTPError) as exception_info:
|
||||
util.urlopen(f'http://{contact.ip}:{contact.port}/dynamic/{datum}')
|
||||
|
||||
assert exception_info.value.status == 404, f"'/dynamic/{datum}' should be missing, but GET was not answered with '404'"
|
||||
|
||||
# Create datum
|
||||
contact = peers[contact_order[1]]
|
||||
contact = peers[contact_order[1]] # 10927
|
||||
reply = util.urlopen(req.Request(f'http://{contact.ip}:{contact.port}/dynamic/{datum}', data=content, method='PUT'))
|
||||
assert reply.status == 201, f"Creation of '/dynamic/{datum}' did not yield '201'"
|
||||
|
||||
# Ensure datum exists
|
||||
contact = peers[contact_order[2]]
|
||||
contact = peers[contact_order[2]] # 54536
|
||||
reply = util.urlopen(f'http://{contact.ip}:{contact.port}/dynamic/{datum}')
|
||||
assert reply.status == 200
|
||||
assert reply.read() == content, f"Content of '/dynamic/{datum}' does not match what was passed"
|
||||
|
||||
# Delete datum
|
||||
contact = peers[contact_order[3]]
|
||||
contact = peers[contact_order[3]] # 40809
|
||||
real_url = util.urlopen(f'http://{contact.ip}:{contact.port}/dynamic/{datum}').geturl() # Determine correct URL
|
||||
reply = util.urlopen(req.Request(real_url, method='DELETE'))
|
||||
assert reply.status in {200, 202, 204}, f"Deletion of '/dynamic/{datum}' did not succeed"
|
||||
|
||||
# Ensure datum is missing
|
||||
contact = peers[contact_order[4]]
|
||||
contact = peers[contact_order[4]] # 63901
|
||||
with pytest.raises(req.HTTPError) as exception_info:
|
||||
util.urlopen(f'http://{contact.ip}:{contact.port}/dynamic/{datum}')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user