More invalid comment tests.
This commit is contained in:
parent
8c6d5265bf
commit
e24ed31367
|
@ -21,7 +21,16 @@ class TestAPI(BaseUserConfig):
|
||||||
content_type='application/json'
|
content_type='application/json'
|
||||||
)
|
)
|
||||||
self.assertStatus(comment_res, 201)
|
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):
|
def test_invalid_signature_create_comment(self):
|
||||||
proposal = Proposal(
|
proposal = Proposal(
|
||||||
status="LIVE"
|
status="LIVE"
|
||||||
|
@ -68,3 +77,29 @@ class TestAPI(BaseUserConfig):
|
||||||
reply_res.json["parentCommentId"],
|
reply_res.json["parentCommentId"],
|
||||||
comment_res.json["id"]
|
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