Merge pull request #6113 from FinnStutzenstein/clearEntitledVotesAfterReset
Clear entitled votes after reset
This commit is contained in:
commit
5a8a87070a
@ -253,6 +253,7 @@ class BasePoll(models.Model):
|
|||||||
option.reset()
|
option.reset()
|
||||||
|
|
||||||
self.voted.clear()
|
self.voted.clear()
|
||||||
|
self.entitled_users_at_stop = None
|
||||||
|
|
||||||
# Reset state
|
# Reset state
|
||||||
self.state = BasePoll.STATE_CREATED
|
self.state = BasePoll.STATE_CREATED
|
||||||
|
@ -7,3 +7,5 @@ pytest<5.4.2
|
|||||||
pytest-django<3.9.0
|
pytest-django<3.9.0
|
||||||
pytest-asyncio<0.11.0
|
pytest-asyncio<0.11.0
|
||||||
pytest-cov<2.8.2
|
pytest-cov<2.8.2
|
||||||
|
types-bleach
|
||||||
|
types-pkg_resources
|
||||||
|
@ -1394,6 +1394,7 @@ class ResetMotionPoll(TestCase):
|
|||||||
pollmethod="YNA",
|
pollmethod="YNA",
|
||||||
type=BasePoll.TYPE_ANALOG,
|
type=BasePoll.TYPE_ANALOG,
|
||||||
state=MotionPoll.STATE_FINISHED,
|
state=MotionPoll.STATE_FINISHED,
|
||||||
|
entitled_users_at_stop=[[{"some": ["important", "data"]}]],
|
||||||
)
|
)
|
||||||
self.poll.create_options()
|
self.poll.create_options()
|
||||||
self.option = self.poll.options.get()
|
self.option = self.poll.options.get()
|
||||||
@ -1416,6 +1417,7 @@ class ResetMotionPoll(TestCase):
|
|||||||
self.assertEqual(poll.votesvalid, None)
|
self.assertEqual(poll.votesvalid, None)
|
||||||
self.assertEqual(poll.votesinvalid, None)
|
self.assertEqual(poll.votesinvalid, None)
|
||||||
self.assertEqual(poll.votescast, None)
|
self.assertEqual(poll.votescast, None)
|
||||||
|
self.assertEqual(poll.entitled_users_at_stop, None)
|
||||||
option = poll.options.get()
|
option = poll.options.get()
|
||||||
self.assertEqual(option.yes, Decimal("0"))
|
self.assertEqual(option.yes, Decimal("0"))
|
||||||
self.assertEqual(option.no, Decimal("0"))
|
self.assertEqual(option.no, Decimal("0"))
|
||||||
@ -1430,6 +1432,7 @@ class ResetMotionPoll(TestCase):
|
|||||||
self.assertHttpStatusVerbose(response, status.HTTP_200_OK)
|
self.assertHttpStatusVerbose(response, status.HTTP_200_OK)
|
||||||
poll = MotionPoll.objects.get()
|
poll = MotionPoll.objects.get()
|
||||||
self.assertFalse(poll.is_pseudoanonymized)
|
self.assertFalse(poll.is_pseudoanonymized)
|
||||||
|
self.assertEqual(poll.entitled_users_at_stop, None)
|
||||||
|
|
||||||
def test_reset_pseudoanonymous(self):
|
def test_reset_pseudoanonymous(self):
|
||||||
self.poll.type = BasePoll.TYPE_PSEUDOANONYMOUS
|
self.poll.type = BasePoll.TYPE_PSEUDOANONYMOUS
|
||||||
@ -1439,6 +1442,7 @@ class ResetMotionPoll(TestCase):
|
|||||||
self.assertHttpStatusVerbose(response, status.HTTP_200_OK)
|
self.assertHttpStatusVerbose(response, status.HTTP_200_OK)
|
||||||
poll = MotionPoll.objects.get()
|
poll = MotionPoll.objects.get()
|
||||||
self.assertTrue(poll.is_pseudoanonymized)
|
self.assertTrue(poll.is_pseudoanonymized)
|
||||||
|
self.assertEqual(poll.entitled_users_at_stop, None)
|
||||||
|
|
||||||
|
|
||||||
class TestMotionPollWithVoteDelegationAutoupdate(TestCase):
|
class TestMotionPollWithVoteDelegationAutoupdate(TestCase):
|
||||||
|
Loading…
Reference in New Issue
Block a user