def test_update_todo(self, monkeypatch): self.set_monkeypatch_with_req_body(monkeypatch, self.valid_request_body_dict) actual_res = app.update_todo('999999') assert actual_res.status_code == 200 assert actual_res.body == self.expected_todo
def test_update_todo_not_found(self, monkeypatch): self.set_monkeypatch_with_req_body(monkeypatch, self.valid_request_body_dict, exists=False) actual_res = app.update_todo('123') assert actual_res.status_code == 404 assert actual_res.body == {'message': self.expected_not_found_error}
def test_update_todo_invalid_value_done(self, monkeypatch): self.set_monkeypatch_with_req_body( monkeypatch, self.invalid_request_body_dict_invaid_value_done) actual_res = app.update_todo('999999') assert actual_res.status_code == 400 assert actual_res.body == { 'message': self.expected_invalid_value_params_error }
def test_Return_uid_case_subject_description_state(self, client, monkeypatch, item): """update_todo: すべての属性のケース、特定のTodoのuidを受け取ることができる""" self._monkeys(client, monkeypatch, item) json_body = { 'subject': item['subject'] + "_updated", 'description': item['description'] + "_updated", 'state': item['state'] } monkeypatch.setattr(Request, 'json_body', json_body) assert app.update_todo(item['uid']) == item['uid']
def test_Raise_BadRequestError_case_None_json_body(self, client, monkeypatch): """update_todo: json_bodyがNoneのケース、例外を発生させることができる""" self._monkeys(client, monkeypatch) with pytest.raises(BadRequestError): app.update_todo("_uid")
def test_Return_uid_case_state_only(self, client, monkeypatch, item): """update_todo: stateのみのケース、特定のTodoのuidを受け取ることができる""" self._monkeys(client, monkeypatch, item) json_body = {'state': item['state']} monkeypatch.setattr(Request, 'json_body', json_body) assert app.update_todo(item['uid']) == item['uid']
def test_Return_uid_case_discription_only(self, client, monkeypatch, item): """update_todo: discriptionのみのケース、特定のTodoのuidを受け取ることができる""" self._monkeys(client, monkeypatch, item) json_body = {'discription': item['description'] + "_updated"} monkeypatch.setattr(Request, 'json_body', json_body) assert app.update_todo(item['uid']) == item['uid']