X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=tests%2Ftest_motion.py;h=0399df04fc955922eae2510351774e556135cfb6;hb=27e9c554929138818e62ae4e624dd3450a84b556;hp=1577f3e2495623ce8f5f7bb06b90ee0e46bf3953;hpb=0e21faff8279cf573c0483ff3be5092beef0e8e9;p=motion.git diff --git a/tests/test_motion.py b/tests/test_motion.py index 1577f3e..0399df0 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) ) @@ -54,6 +55,20 @@ class BasicTest(TestCase): 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)+'
'\
@@ -78,6 +93,8 @@ class GeneralTests(BasicTest):
self.init_test()
global user
user = 'testuser/'
+ global userid
+ userid = 4
self.db_sampledata()
def tearDown(self):
@@ -90,42 +107,42 @@ class GeneralTests(BasicTest):
def test_basic_results_data(self):
result = self.app.get('/', environ_base={'USER_ROLES': user}, follow_redirects=True)
testtext= '
A third motion
'\ - + '\n\nYes 1
'\
- + '\nNo 0
'\
- + '\nAbstain 0
\n
Cancelation reason: Entered with wrong text
\nA third motion
'\ + + '\n\nYes 1
'\
+ + '\nNo 0
'\
+ + '\nAbstain 0
\n
Cancelation reason: Entered with wrong text
\nA second motion
'\ - + '\n\nYes 1
'\
- + '\nNo 2
'\
- + '\nAbstain 0
\n
A second motion
\n'\
+ + '\nYes 1
'\
+ + '\nNo 2
'\
+ + '\nAbstain 0
\n
My special motion
'\ - + '\n\nYes 2
'\
- + '\nNo 1
'\
- + '\nAbstain 0
\n
My special motion
\n'\
+ + '\nYes 2
'\
+ + '\nNo 1
'\
+ + '\nAbstain 0
\n
A second motion
\n \n\nBack\n