X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=tests%2Ftest_motion.py;h=1bc65858461318e377cf8660479502895cf80cff;hb=66a7e727089249cd3eeea99c2aead5fb6a9550ce;hp=1577f3e2495623ce8f5f7bb06b90ee0e46bf3953;hpb=0e21faff8279cf573c0483ff3be5092beef0e8e9;p=motion.git diff --git a/tests/test_motion.py b/tests/test_motion.py index 1577f3e..1bc6585 100644 --- a/tests/test_motion.py +++ b/tests/test_motion.py @@ -139,7 +139,7 @@ class GeneralTests(BasicTest): def test_basic_results_data_details(self): motion='g1.20200402.002' result = self.app.get('/motion/' + motion, environ_base={'USER_ROLES': user}, follow_redirects=True) - testtext= '

A second motion

\n \n\nBack\n' + testtext= '

A second motion

\n \n\nBack' self.assertIn(str.encode(testtext), result.data) def test_vote(self): @@ -276,14 +276,14 @@ class VoterTests(BasicTest): def test_vote_closed(self): motion='g1.20200402.002' response = self.createVote(user, motion, 'abstain') - self.assertEqual(response.status_code, 500) - self.assertIn(str.encode('Error, motion deadline has passed'), response.data) + self.assertEqual(response.status_code, 403) + self.assertIn(str.encode('Error, out of time'), response.data) def test_vote_canceled(self): motion='g1.20200402.003' response = self.createVote(user, motion, 'abstain') - self.assertEqual(response.status_code, 500) - self.assertIn(str.encode('Error, motion deadline has passed'), response.data) + self.assertEqual(response.status_code, 403) + self.assertIn(str.encode('Error, motion was canceled'), response.data) def test_vote_not_given(self): motion='g1.30190402.001' @@ -416,9 +416,25 @@ class CreateMotionTests(BasicTest): title='My Motion' content='My body' response = self.createMotion(user, title, content, '21', 'group1') - self.assertEqual(response.status_code, 500) + self.assertEqual(response.status_code, 400) self.assertIn(str.encode('Error, invalid length'), response.data) + def test_createMotionMissingData(self): + title='' + content='' + response = self.createMotion(user, title, content, '3', 'group1') + self.assertEqual(response.status_code, 400) + self.assertIn(str.encode('Error, missing title'), response.data) + title='New Motion' + response = self.createMotion(user, title, content, '3', 'group1') + self.assertEqual(response.status_code, 400) + self.assertIn(str.encode('Error, missing content'), response.data) + title='' + content='New Content' + response = self.createMotion(user, title, content, '3', 'group1') + self.assertEqual(response.status_code, 400) + self.assertIn(str.encode('Error, missing title'), response.data) + def test_createMotionWrongGroup(self): title='My Motion' content='My body' @@ -461,7 +477,7 @@ class CreateMotionTests(BasicTest): motion='g1.20200402.004' response = self.cancelMotion(user, motion, reason) self.assertEqual(response.status_code, 403) - self.assertIn(str.encode('Error, out of time'), response.data) + self.assertIn(str.encode('Error, motion was canceled'), response.data) def test_finishMotion(self): self.db_sampledata()