rename fullnames
Handle a couple places with `t3_` that persisted from code movement. on master after time of branch. Then, fix commenting, which used inaccurate fullname parsing logic.
This commit is contained in:
parent
db1f578f26
commit
8191d5a4cf
12 changed files with 27 additions and 28 deletions
|
@ -15,7 +15,7 @@ class CommentsFixture:
|
|||
assert submit_get_response.status_code == 200
|
||||
comment_body = data.get('body', util.generate_text())
|
||||
submit_comment_response = client.post("/comment", data={
|
||||
"parent_fullname": f't2_{post_id}',
|
||||
"parent_fullname": f'post_{post_id}',
|
||||
'parent_level': 1,
|
||||
'submission': post_id,
|
||||
"body": comment_body,
|
||||
|
|
|
@ -24,9 +24,9 @@ class SubmissionsFixture:
|
|||
assert post_body in submit_post_response.text
|
||||
post_info = util.ItemData.from_html(submit_post_response.text)
|
||||
post_id_full = post_info.id_full
|
||||
assert post_id_full.startswith('t2_')
|
||||
assert post_id_full.startswith('post_')
|
||||
|
||||
post_id = int(post_id_full[3:])
|
||||
post_id = int(post_id_full.split('_')[1])
|
||||
|
||||
db = db_session()
|
||||
submission = db.query(Submission).filter_by(id=post_id).first()
|
||||
|
|
|
@ -115,19 +115,19 @@ def test_comment_descendant_count(accounts, submissions, comments):
|
|||
|
||||
reply1 = comments.comment_for_client(alice_client, post.id, {
|
||||
'body': 'You\'re wrong, this isn\'t contentious',
|
||||
'parent_fullname': f't3_{root.id}',
|
||||
'parent_fullname': f'comment_{root.id}',
|
||||
'parent_level': root.level,
|
||||
})
|
||||
|
||||
rereply1 = comments.comment_for_client(alice_client, post.id, {
|
||||
'body': 'no u',
|
||||
'parent_fullname': f't3_{reply1.id}',
|
||||
'parent_fullname': f'comment_{reply1.id}',
|
||||
'parent_level': reply1.level,
|
||||
})
|
||||
|
||||
reply2 = comments.comment_for_client(alice_client, post.id, {
|
||||
'body': 'Good poast',
|
||||
'parent_fullname': f't3_{root.id}',
|
||||
'parent_fullname': f'comment_{root.id}',
|
||||
'parent_level': root.level,
|
||||
})
|
||||
|
||||
|
@ -153,7 +153,7 @@ def test_more_button_label_in_deep_threads(accounts, submissions, comments):
|
|||
for i in range(1, 25 + 1):
|
||||
c = comments.comment_for_client(alice_client, post.id, {
|
||||
'body': str(i),
|
||||
'parent_fullname': f't3_{c.id}',
|
||||
'parent_fullname': f'comment_{c.id}',
|
||||
'parent_level': c.level,
|
||||
})
|
||||
if i % 5 == 0:
|
||||
|
|
|
@ -37,9 +37,9 @@ def no_rate_limit(test_function):
|
|||
# this is meant to be a utility class that stores post and comment references so you can use them in other calls
|
||||
# it's pretty barebones and will probably be fleshed out
|
||||
class ItemData:
|
||||
id = None
|
||||
id_full = None
|
||||
url = None
|
||||
id: str | None = None
|
||||
id_full: str | None = None
|
||||
url: str | None = None
|
||||
|
||||
@staticmethod
|
||||
def from_html(text):
|
||||
|
@ -52,7 +52,7 @@ class ItemData:
|
|||
|
||||
result = ItemData()
|
||||
result.id = match.group(1) # this really should get yanked out of the JS, not the URL
|
||||
result.id_full = f"t2_{result.id}"
|
||||
result.id_full = f"post_{result.id}"
|
||||
result.url = url
|
||||
return result
|
||||
|
||||
|
@ -69,6 +69,6 @@ class ItemData:
|
|||
|
||||
result = ItemData()
|
||||
result.id = match.group(1) # this really should get yanked out of the JS, not the HTML
|
||||
result.id_full = f"t3_{result.id}"
|
||||
result.id_full = f"comment_{result.id}"
|
||||
result.url = f"/comment/{result.id}"
|
||||
return result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue