X-Git-Url: https://code.wpia.club/?p=motion.git;a=blobdiff_plain;f=tests%2Ftest_motion.py;h=7ef5ceac11c309943e8fdb0e910d999c8e051bef;hp=769deb131896a029710f670bad96e0dcdcd80cca;hb=068793bc0abe796473cb252ed7481b56b91f47bc;hpb=4cfc1bb07644043d1e223178a98ea47f6a61d338 diff --git a/tests/test_motion.py b/tests/test_motion.py index 769deb1..7ef5cea 100644 --- a/tests/test_motion.py +++ b/tests/test_motion.py @@ -1,6 +1,5 @@ from datetime import datetime from tests.test_basics import BasicTest -import postgresql from motion import app # no specific rights required @@ -479,6 +478,24 @@ class CreateMotionTests(BasicTest): self.assertEqual(response.status_code, 403) self.assertIn(str.encode('Error, out of time'), response.data) + def test_createMotionWait(self): + # test no limit given + self.db_sampledata() + title='My Motion' + content='My body' + response = self.createMotion(user, title, content, '3', 'group1') + self.assertEqual(response.status_code, 302) + + # test different host + app.config.update(MOTION_WAIT_MINUTES={'127.0.0.1:5001':1}) + response = self.createMotion(user, title, content, '3', 'group1') + self.assertEqual(response.status_code, 302) + + # test 3 minutes + app.config.update(MOTION_WAIT_MINUTES={'127.0.0.1:5000':3}) + response = self.createMotion(user, title, content, '3', 'group1') + self.assertIn(str.encode('Error, time between last motion to short. The current setting is 3 minute(s).'), response.data) + class AuditMotionTests(BasicTest): def setUp(self):