def test_set_new_issue_failure1(self): # no author request = self.__get_dummy_request_for_new_issue() response = set_new_issue(request) self.assertIsNotNone(response) self.assertTrue(400, response.status_code)
def test_set_new_issue_failure4(self): # wrong language self.config.testing_securitypolicy(userid='Tobias', permissive=True) request = self.__get_dummy_request_for_new_issue() request.json_body['lang'] = 'sw' response = set_new_issue(request) self.assertIsNotNone(response) self.assertTrue(400, response.status_code)
def test_set_new_issue_failure3(self): # duplicated info self.config.testing_securitypolicy(userid='Tobias', permissive=True) request = self.__get_dummy_request_for_new_issue() db_issue = DBDiscussionSession.query(Issue).get(1) request.json_body['info'] = db_issue.info response = set_new_issue(request) self.assertIsNotNone(response) self.assertTrue(400, response.status_code)
def test_set_new_issue(self): self.config.testing_securitypolicy(userid='Tobias', permissive=True) request = self.__get_dummy_request_for_new_issue() response = set_new_issue(request) self.assertIsNotNone(response) self.assertEqual( DBDiscussionSession.query(Issue).filter_by( title=request.json_body['title']).count(), 1) DBDiscussionSession.query(Issue).filter_by( title=request.json_body['title']).delete() transaction.commit()