X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=tests%2Ftest_motion.py;h=0bee29420e123a31029dcc6922b3d1c9103a71d7;hb=4af338e33108c609381f4c60b6cc12b50da7f107;hp=c1f996c3312966439f5bb4a5572cd5637372d350;hpb=a53a0a3e8ad96f0805c05a45a06e15352dd45f72;p=motion.git diff --git a/tests/test_motion.py b/tests/test_motion.py index c1f996c..0bee294 100644 --- a/tests/test_motion.py +++ b/tests/test_motion.py @@ -9,7 +9,8 @@ app.config.update( DEBUGUSER = {}, GROUP_PREFIX = {'127.0.0.1:5000': {'group1': 'g1', 'group2': 'g2'}}, DURATION = {'127.0.0.1:5000':[3, 7, 14]}, - SERVER_NAME = '127.0.0.1:5000' + SERVER_NAME = '127.0.0.1:5000', + MAX_PROXY=2 ) app.config['TESTING'] = True @@ -26,9 +27,9 @@ class BasicTest(TestCase): self.db_clear() # functions to manipulate motions - def createVote(self, user, motion, vote): + def createVote(self, user, motion, vote, voter): return self.app.post( - '/motion/' + motion +'/vote', + '/motion/' + motion + '/vote/' + str(voter), environ_base={'USER_ROLES': user}, data=dict(vote=vote) ) @@ -48,6 +49,26 @@ class BasicTest(TestCase): data=dict(reason=reason) ) + def finishMotion(self, user, motion): + return self.app.post( + '/motion/' + motion +'/finish', + environ_base={'USER_ROLES': user} + ) + + def addProxy(self, user, voter, proxy): + return self.app.post( + '/proxy/add', + environ_base={'USER_ROLES': user}, + data=dict(voter=voter, proxy=proxy) + ) + + def revokeProxy(self, user, id): + return self.app.post( + '/proxy/revoke', + environ_base={'USER_ROLES': user}, + data=dict(id=id) + ) + def buildResultText(self, motiontext, yes, no, abstain): return '
'+motiontext+'
\n\nYes '+str(yes)+'
'\
+ '\nNo '+str(no)+'
'\
@@ -72,6 +93,8 @@ class GeneralTests(BasicTest):
self.init_test()
global user
user = 'testuser/'
+ global userid
+ userid = 4
self.db_sampledata()
def tearDown(self):
@@ -120,6 +143,8 @@ class GeneralTests(BasicTest):
+ '\nNo 1
'\
+ '\nAbstain 0
\n
A second motion
\n \n\nBack\n