Beispiel #1
0
    def test_Vote_read(self):
        """
        Tests Vote model read
        """
        my_model = VoteF.create(choice='n')

        self.assertTrue(my_model.choice == 'n')
Beispiel #2
0
    def test_vote_delete(self):
        """Tests Vote model delete."""
        model = VoteF.create()

        model.delete()

        # check if deleted
        self.assertTrue(model.pk is None)
Beispiel #3
0
    def test_vote_delete(self):
        """Tests Vote model delete."""
        model = VoteF.create()

        model.delete()

        # check if deleted
        self.assertTrue(model.pk is None)
Beispiel #4
0
    def test_vote_create(self):
        """Tests Vote model creation."""
        model = VoteF.create()

        # check if PK exists
        self.assertTrue(model.pk is not None)

        # check if we have a user
        self.assertTrue(model.user is not None)
Beispiel #5
0
    def test_vote_create(self):
        """Tests Vote model creation."""
        model = VoteF.create()

        # check if PK exists
        self.assertTrue(model.pk is not None)

        # check if we have a user
        self.assertTrue(model.user is not None)
Beispiel #6
0
 def setUp(self):
     """
     Setup before each test
     """
     logging.disable(logging.CRITICAL)
     self.user = UserF.create(**{"username": "******", "password": "******", "is_staff": True})
     self.project = ProjectF.create()
     self.committee = CommitteeF.create(project=self.project, users=[self.user])
     self.ballot = BallotF.create(committee=self.committee)
     self.vote = VoteF.create(ballot=self.ballot)
Beispiel #7
0
    def test_vote_update(self):
        """Tests Vote model update."""
        model = VoteF.create()
        new_model_data = {'choice': 'y'}
        model.__dict__.update(new_model_data)
        model.save()

        # check if updated
        for key, val in new_model_data.items():
            self.assertEqual(model.__dict__.get(key), val)
Beispiel #8
0
    def test_vote_update(self):
        """Tests Vote model update."""
        model = VoteF.create()
        new_model_data = {
            'choice': 'y'
        }
        model.__dict__.update(new_model_data)
        model.save()

        # check if updated
        for key, val in new_model_data.items():
            self.assertEqual(model.__dict__.get(key), val)
Beispiel #9
0
 def setUp(self):
     """
     Setup before each test
     """
     logging.disable(logging.CRITICAL)
     self.user = UserF.create(**{
         'username': '******',
         'password': '******',
         'is_staff': True
     })
     self.project = ProjectF.create()
     self.committee = CommitteeF.create(project=self.project,
                                          users=[self.user])
     self.ballot = BallotF.create(committee=self.committee)
     self.vote = VoteF.create(ballot=self.ballot)
Beispiel #10
0
 def setUp(self):
     """
     Setup before each test
     """
     logging.disable(logging.CRITICAL)
     self.my_user = UserF.create(**{
         'username': '******',
         'password': '******',
         'is_staff': True
     })
     self.my_project = ProjectF.create()
     self.my_committee = CommitteeF.create(project=self.my_project,
                                          users=[self.my_user])
     self.my_ballot = BallotF.create(committee=self.my_committee)
     self.my_vote = VoteF.create(ballot=self.my_ballot)
Beispiel #11
0
    def test_vote_read(self):
        """Tests Vote model read."""
        model = VoteF.create(choice='n')

        self.assertTrue(model.choice == 'n')