More invalid comment tests.
This commit is contained in:
parent
8c6d5265bf
commit
e24ed31367
|
@ -22,6 +22,15 @@ class TestAPI(BaseUserConfig):
|
|||
)
|
||||
self.assertStatus(comment_res, 201)
|
||||
|
||||
def test_invalid_proposal_id_create_comment(self):
|
||||
comment_res = self.app.post(
|
||||
"/api/v1/proposals/12345/comments",
|
||||
data=json.dumps(test_comment),
|
||||
headers=self.headers,
|
||||
content_type='application/json'
|
||||
)
|
||||
self.assertStatus(comment_res, 404)
|
||||
|
||||
def test_invalid_signature_create_comment(self):
|
||||
proposal = Proposal(
|
||||
status="LIVE"
|
||||
|
@ -68,3 +77,29 @@ class TestAPI(BaseUserConfig):
|
|||
reply_res.json["parentCommentId"],
|
||||
comment_res.json["id"]
|
||||
)
|
||||
|
||||
def test_invalid_parent_comment_id_create_reply(self):
|
||||
proposal = Proposal(
|
||||
status="LIVE"
|
||||
)
|
||||
db.session.add(proposal)
|
||||
db.session.commit()
|
||||
proposal_id = proposal.id
|
||||
|
||||
comment_res = self.app.post(
|
||||
"/api/v1/proposals/{}/comments".format(proposal_id),
|
||||
data=json.dumps(test_comment),
|
||||
headers=self.headers,
|
||||
content_type='application/json'
|
||||
)
|
||||
self.assertStatus(comment_res, 201)
|
||||
|
||||
test_reply_copy = test_reply.copy()
|
||||
test_reply_copy["parentCommentId"] = comment_res.json["id"] + 1
|
||||
reply_res = self.app.post(
|
||||
"/api/v1/proposals/{}/comments".format(proposal_id),
|
||||
data=json.dumps(test_reply_copy),
|
||||
headers=self.headers,
|
||||
content_type='application/json'
|
||||
)
|
||||
self.assertStatus(reply_res, 400)
|
||||
|
|
Loading…
Reference in New Issue