Beispiel #1
0
    def test_edit_election(self):
        """ Test the edit_election function. """
        create_elections(self.session)
        election = nuancierlib.get_election(self.session, 2)

        new_election = nuancierlib.edit_election(
            self.session,
            election=election,
            election_name='elec name',
            election_folder='Test',
            election_year=2048,
            election_date_start=TODAY,
            election_date_end=TODAY + timedelta(days=2),
            submission_date_start=TODAY - timedelta(days=2),
            election_n_choice=42,
            election_badge_link='http://badges.fp.o/1234',
            user='******',
        )

        self.assertEqual(new_election.election_name, 'elec name')
        self.assertEqual(new_election.election_folder, 'Test')
        self.assertEqual(new_election.election_year, 2048)
        self.assertEqual(new_election.election_date_start, TODAY)
        self.assertEqual(
            new_election.election_date_end, TODAY + timedelta(days=2))
        self.assertEqual(
            new_election.submission_date_start, TODAY - timedelta(days=2))
        self.assertEqual(new_election.election_n_choice, 42)
        self.assertEqual(
            new_election.election_badge_link, 'http://badges.fp.o/1234')
    def test_get_elections_open(self):
        """ Test the get_elections_open function. """
        create_elections(self.session)

        elections = nuancierlib.get_elections_open(self.session)
        self.assertEqual(1, len(elections))
        self.assertEqual('Wallpaper F20', elections[0].election_name)
Beispiel #3
0
    def test_get_elections_open(self):
        """ Test the get_elections_open function. """
        create_elections(self.session)

        elections = nuancierlib.get_elections_open(self.session)
        self.assertEqual(1, len(elections))
        self.assertEqual('Wallpaper F20', elections[0].election_name)
Beispiel #4
0
    def test_elections_api_repr(self):
        """ Test the api_repr function of Elections. """
        create_elections(self.session)
        create_candidates(self.session)

        election = nuancierlib.get_election(self.session, 1)
        self.assertEqual(
            election.api_repr(1),
            {'name': 'Wallpaper F19', 'year': 2013}
        )
Beispiel #5
0
    def test_get_candidate(self):
        """ Test the get_candidate function. """
        create_elections(self.session)
        create_candidates(self.session)

        candidate = nuancierlib.get_candidate(self.session, 1)
        self.assertEqual('Image ok', candidate.candidate_name)

        candidate = nuancierlib.get_candidate(self.session, 10)
        self.assertEqual(None, candidate)
    def test_get_stats(self):
        """ Test the get_stats function. """
        create_elections(self.session)
        create_candidates(self.session)
        create_votes(self.session)

        stats = nuancierlib.get_stats(self.session, 1)
        self.assertEqual(5, stats['votes'])
        self.assertEqual(3, stats['voters'])
        self.assertEqual([[1, 1], [2, 2]], stats['data'])
    def test_get_candidate(self):
        """ Test the get_candidate function. """
        create_elections(self.session)
        create_candidates(self.session)

        candidate = nuancierlib.get_candidate(self.session, 1)
        self.assertEqual('Image ok', candidate.candidate_name)

        candidate = nuancierlib.get_candidate(self.session, 10)
        self.assertEqual(None, candidate)
    def test_get_votes_user(self):
        """ Test the get_votes_user function. """
        create_elections(self.session)
        create_candidates(self.session)
        create_votes(self.session)

        votes = nuancierlib.get_votes_user(self.session, 1, 'pingou')
        self.assertEqual(2, len(votes))
        self.assertEqual(1, votes[0].candidate_id)
        self.assertEqual(2, votes[1].candidate_id)
Beispiel #9
0
    def test_get_stats(self):
        """ Test the get_stats function. """
        create_elections(self.session)
        create_candidates(self.session)
        create_votes(self.session)

        stats = nuancierlib.get_stats(self.session, 1)
        self.assertEqual(5, stats['votes'])
        self.assertEqual(3, stats['voters'])
        self.assertEqual([[1, 1], [2, 2]], stats['data'])
Beispiel #10
0
    def test_get_votes_user(self):
        """ Test the get_votes_user function. """
        create_elections(self.session)
        create_candidates(self.session)
        create_votes(self.session)

        votes = nuancierlib.get_votes_user(self.session, 1, 'pingou')
        self.assertEqual(2, len(votes))
        self.assertEqual(1, votes[0].candidate_id)
        self.assertEqual(2, votes[1].candidate_id)
    def test_get_candidate(self):
        """ Test the get_candidate function. """
        create_elections(self.session)
        create_candidates(self.session)

        candidate = nuancierlib.get_candidate(self.session, 1)
        self.assertEqual('DSC_0951', candidate.candidate_name)

        candidate = nuancierlib.get_candidate(self.session, 4)
        self.assertEqual('DSC_0922', candidate.candidate_name)
Beispiel #12
0
    def test_elections_repr(self):
        """ Test the __repr__ function of Elections. """
        create_elections(self.session)
        create_candidates(self.session)

        election = nuancierlib.get_election(self.session, 1)
        self.assertEqual(
            election.__repr__(),
            "Elections(id:1, name:u'Wallpaper F19', year:2013)"
        )
Beispiel #13
0
    def test_candidates_api_repr(self):
        """ Test the api_repr function of Elections. """
        create_elections(self.session)
        create_candidates(self.session)

        candidate = nuancierlib.get_candidate(self.session, 1)
        self.assertEqual(
            candidate.api_repr(1),
            {'election': u'Wallpaper F19', 'name': u'DSC_0951'}
        )
    def test_add_candidate(self):
        """ Test the add_candidate function. """
        create_elections(self.session)

        self.assertRaises(
            nuancierlib.NuancierException,
            nuancierlib.add_candidate,
            session=self.session,
            candidate_file='test.png',
            candidate_name='test image',
            candidate_author='pingou',
            candidate_license='CC-BY-SA',
            candidate_submitter='pingou',
            submitter_email='[email protected]',
            candidate_original_url=None,
            election_id=2,
        )

        nuancierlib.add_candidate(
            session=self.session,
            candidate_file='test.png',
            candidate_name='test image',
            candidate_author='pingou',
            candidate_license='CC-BY-SA',
            candidate_submitter='pingou',
            submitter_email='[email protected]',
            candidate_original_url=None,
            election_id=2,
            user='******',
        )
        self.session.commit()

        candidates = nuancierlib.get_candidates(self.session, 2, False)
        self.assertEqual(1, len(candidates))
        self.assertEqual('test image', candidates[0].candidate_name)
        self.assertEqual('test.png', candidates[0].candidate_file)

        candidates = nuancierlib.get_candidates(self.session, 2, True)
        self.assertEqual(0, len(candidates))

        self.assertRaises(
            nuancierlib.NuancierException,
            nuancierlib.add_candidate,
            session=self.session,
            candidate_file='test.png',
            candidate_name='test image',
            candidate_author='pingou',
            candidate_license='CC-BY-SA',
            candidate_submitter='pingou',
            submitter_email='[email protected]',
            candidate_original_url='http://example.org',
            election_id=2,
            user='******',
        )
Beispiel #15
0
    def test_add_candidate(self):
        """ Test the add_candidate function. """
        create_elections(self.session)

        self.assertRaises(
            nuancierlib.NuancierException,
            nuancierlib.add_candidate,
            session=self.session,
            candidate_file='test.png',
            candidate_name='test image',
            candidate_author='pingou',
            candidate_license='CC-BY-SA',
            candidate_submitter='pingou',
            submitter_email='[email protected]',
            candidate_original_url=None,
            election_id=2,
        )

        nuancierlib.add_candidate(
            session=self.session,
            candidate_file='test.png',
            candidate_name='test image',
            candidate_author='pingou',
            candidate_license='CC-BY-SA',
            candidate_submitter='pingou',
            submitter_email='[email protected]',
            candidate_original_url=None,
            election_id=2,
            user='******',
        )
        self.session.commit()

        candidates = nuancierlib.get_candidates(self.session, 2, False)
        self.assertEqual(1, len(candidates))
        self.assertEqual('test image', candidates[0].candidate_name)
        self.assertEqual('test.png', candidates[0].candidate_file)

        candidates = nuancierlib.get_candidates(self.session, 2, True)
        self.assertEqual(0, len(candidates))

        self.assertRaises(
            nuancierlib.NuancierException,
            nuancierlib.add_candidate,
            session=self.session,
            candidate_file='test.png',
            candidate_name='test image',
            candidate_author='pingou',
            candidate_license='CC-BY-SA',
            candidate_submitter='pingou',
            submitter_email='[email protected]',
            candidate_original_url='http://example.org',
            election_id=2,
            user='******',
        )
Beispiel #16
0
    def test_election_public(self):
        """ Test the election_public property of Elections. """
        create_elections(self.session)

        election = nuancierlib.get_election(self.session, 1)
        self.assertEqual(election.election_public, True)

        election = nuancierlib.get_election(self.session, 2)
        self.assertEqual(election.election_public, False)

        election = nuancierlib.get_election(self.session, 3)
        self.assertEqual(election.election_public, False)
    def test_get_results(self):
        """ Test the get_results function. """
        create_elections(self.session)
        create_candidates(self.session)
        create_votes(self.session)

        results = nuancierlib.get_results(self.session, 1)
        self.assertEqual(2, len(results))
        self.assertEqual('Image ok', results[0][0].candidate_name)  # candidate
        self.assertEqual(3, results[0][1])  # number of votes
        self.assertEqual('Image too narrow', results[1][0].candidate_name)
        self.assertEqual(2, results[1][1])
Beispiel #18
0
    def test_votes_repr(self):
        """ Test the __repr__ function of Votes. """
        create_elections(self.session)
        create_candidates(self.session)
        create_votes(self.session)

        votes = nuancierlib.get_votes_user(self.session, 1, 'pingou')
        self.assertTrue(
            votes[0].__repr__().startswith(
                "Votes(name:u'pingou', candidate_id:1, created:"
            )
        )
Beispiel #19
0
    def test_election_public(self):
        """ Test the election_public property of Elections. """
        create_elections(self.session)

        election = nuancierlib.get_election(self.session, 1)
        self.assertEqual(election.election_public, True)

        election = nuancierlib.get_election(self.session, 2)
        self.assertEqual(election.election_public, False)

        election = nuancierlib.get_election(self.session, 3)
        self.assertEqual(election.election_public, False)
Beispiel #20
0
    def test_get_results(self):
        """ Test the get_results function. """
        create_elections(self.session)
        create_candidates(self.session)
        create_votes(self.session)

        results = nuancierlib.get_results(self.session, 1)
        self.assertEqual(2, len(results))
        self.assertEqual('Image ok', results[0][0].candidate_name)  # candidate
        self.assertEqual(3, results[0][1])  # number of votes
        self.assertEqual('Image too narrow', results[1][0].candidate_name)
        self.assertEqual(2, results[1][1])
Beispiel #21
0
    def test_generate_cache_no_picture_folder(self):
        """ Test the generate_cache function. """

        create_elections(self.session)
        election = nuancierlib.get_election(self.session, 2)

        self.assertRaises(nuancierlib.NuancierException,
                          nuancierlib.generate_cache,
                          session=self.session,
                          election=election,
                          picture_folder='none',
                          cache_folder=CACHE_FOLDER,
                          size=(128, 128))
Beispiel #22
0
    def test_votes_repr(self):
        """ Test the __repr__ function of Votes. """
        create_elections(self.session)
        create_candidates(self.session)
        create_votes(self.session)

        votes = nuancierlib.get_votes_user(self.session, 1, 'pingou')
        if six.PY2:
            self.assertTrue(votes[0].__repr__().startswith(
                "Votes(name:u'pingou', candidate_id:1, created:"))
        else:
            self.assertTrue(votes[0].__repr__().startswith(
                "Votes(name:'pingou', candidate_id:1, created:"))
Beispiel #23
0
    def test_candidates_repr(self):
        """ Test the __repr__ function of Candidates. """
        create_elections(self.session)
        create_candidates(self.session)

        candidate = nuancierlib.get_candidate(self.session, 1)
        self.assertTrue(
            candidate.__repr__().startswith(
                "Candidates(file:u'DSC_0951.JPG', "
                       "name:u'DSC_0951', "
                       "election_id:1, "
            )
        )
Beispiel #24
0
    def test_edit_election(self):
        """ Test the edit_election function. """
        create_elections(self.session)
        election = nuancierlib.get_election(self.session, 2)

        self.assertRaises(
            nuancierlib.NuancierException,
            nuancierlib.edit_election,
            session=self.session,
            election=election,
            election_name='elec name',
            election_folder='Test',
            election_year=2048,
            election_date_start=TODAY,
            election_date_end=TODAY + timedelta(days=2),
            submission_date_start=TODAY - timedelta(days=2),
            submission_date_end=TODAY - timedelta(days=1),
            election_n_choice=42,
            user_n_candidates=5,
            election_badge_link='http://badges.fp.o/1234',
        )

        new_election = nuancierlib.edit_election(
            self.session,
            election=election,
            election_name='elec name',
            election_folder='Test',
            election_year=2048,
            election_date_start=TODAY,
            election_date_end=TODAY + timedelta(days=2),
            submission_date_start=TODAY - timedelta(days=2),
            submission_date_end=TODAY - timedelta(days=1),
            election_n_choice=42,
            user_n_candidates=5,
            election_badge_link='http://badges.fp.o/1234',
            user='******',
        )

        self.assertEqual(new_election.election_name, 'elec name')
        self.assertEqual(new_election.election_folder, 'Test')
        self.assertEqual(new_election.election_year, 2048)
        self.assertEqual(new_election.election_date_start, TODAY)
        self.assertEqual(new_election.election_date_end,
                         TODAY + timedelta(days=2))
        self.assertEqual(new_election.submission_date_start,
                         TODAY - timedelta(days=2))
        self.assertEqual(new_election.submission_date_end,
                         TODAY - timedelta(days=1))
        self.assertEqual(new_election.election_n_choice, 42)
        self.assertEqual(new_election.election_badge_link,
                         'http://badges.fp.o/1234')
Beispiel #25
0
    def test_add_vote(self):
        """ Test the add_vote function. """
        create_elections(self.session)
        create_candidates(self.session)

        nuancierlib.add_vote(session=self.session,
                             candidate_id=2,
                             username='******')

        self.session.commit()

        votes = nuancierlib.get_votes_user(self.session, 1, 'pingou')
        self.assertEqual(1, len(votes))
        self.assertEqual(2, votes[0].candidate_id)
    def test_get_candidates(self):
        """ Test the get_candidates function. """
        create_elections(self.session)
        create_candidates(self.session)

        candidates = nuancierlib.get_candidates(self.session, 1)
        self.assertEqual(2, len(candidates))
        self.assertEqual('DSC_0930', candidates[0].candidate_name)
        self.assertEqual('DSC_0951', candidates[1].candidate_name)

        candidates = nuancierlib.get_candidates(self.session, 2)
        self.assertEqual(2, len(candidates))
        self.assertEqual('DSC_0922', candidates[0].candidate_name)
        self.assertEqual('DSC_0923', candidates[1].candidate_name)
Beispiel #27
0
    def test_candidates_api_repr(self):
        """ Test the api_repr function of Elections. """
        create_elections(self.session)
        create_candidates(self.session)

        candidate = nuancierlib.get_candidate(self.session, 1)
        self.assertEqual(
            candidate.api_repr(1), {
                'author': u'pingou',
                'license': u'CC-BY-SA',
                'name': u'Image ok',
                'original_url': None,
                'submitter': u'pingou',
            })
Beispiel #28
0
    def test_elections_repr(self):
        """ Test the __repr__ function of Elections. """
        create_elections(self.session)
        create_candidates(self.session)

        election = nuancierlib.get_election(self.session, 1)
        if six.PY2:
            self.assertEqual(
                election.__repr__(),
                "Elections(id:1, name:u'Wallpaper F19', year:2013)")
        else:
            self.assertEqual(
                election.__repr__(),
                "Elections(id:1, name:'Wallpaper F19', year:2013)")
    def test_generate_cache_no_picture_folder(self):
        """ Test the generate_cache function. """

        create_elections(self.session)
        election = nuancierlib.get_election(self.session, 2)

        self.assertRaises(
            nuancierlib.NuancierException,
            nuancierlib.generate_cache,
            session=self.session,
            election=election,
            picture_folder='none',
            cache_folder=CACHE_FOLDER,
            size=(128, 128)
        )
Beispiel #30
0
    def test_elections_api_repr(self):
        """ Test the api_repr function of Elections. """
        create_elections(self.session)
        create_candidates(self.session)

        election = nuancierlib.get_election(self.session, 1)
        self.assertEqual(
            election.api_repr(1), {
                'date_end': TODAY - timedelta(days=8),
                'date_start': TODAY - timedelta(days=10),
                'id': 1,
                'name': u'Wallpaper F19',
                'submission_date_start': TODAY - timedelta(days=15),
                'submission_date_end': TODAY - timedelta(days=13),
                'year': 2013
            })
Beispiel #31
0
    def test_generate_cache(self):
        """ Test the generate_cache function. """

        create_elections(self.session)
        create_candidates(self.session)
        election = nuancierlib.get_election(self.session, 2)

        self.assertFalse(os.path.exists(CACHE_FOLDER))

        nuancierlib.generate_cache(session=self.session,
                                   election=election,
                                   picture_folder=PICTURE_FOLDER,
                                   cache_folder=CACHE_FOLDER,
                                   size=(128, 128))

        self.assertTrue(os.path.exists(CACHE_FOLDER))
    def test_toggle_public(self):
        """ Test the toggle_public function. """
        create_elections(self.session)

        election = nuancierlib.get_election(self.session, 1)
        self.assertEqual(True, election.election_public)

        nuancierlib.toggle_public(self.session, 1)

        election = nuancierlib.get_election(self.session, 1)
        self.assertEqual(False, election.election_public)

        nuancierlib.toggle_public(self.session, 1)

        election = nuancierlib.get_election(self.session, 1)
        self.assertEqual(True, election.election_public)
Beispiel #33
0
    def test_candidates_api_repr(self):
        """ Test the api_repr function of Elections. """
        create_elections(self.session)
        create_candidates(self.session)

        candidate = nuancierlib.get_candidate(self.session, 1)
        self.assertEqual(
            candidate.api_repr(1),
            {
                'author': u'pingou',
                'license': u'CC-BY-SA',
                'name': u'Image ok',
                'original_url': None,
                'submitter': u'pingou',
            }
        )
Beispiel #34
0
    def test_candidates_repr(self):
        """ Test the __repr__ function of Candidates. """
        create_elections(self.session)
        create_candidates(self.session)

        candidate = nuancierlib.get_candidate(self.session, 1)
        if six.PY2:
            self.assertTrue(candidate.__repr__().startswith(
                "Candidates(file:u'ok.JPG', "
                "name:u'Image ok', "
                "election_id:1, "))
        else:
            self.assertTrue(candidate.__repr__().startswith(
                "Candidates(file:'ok.JPG', "
                "name:'Image ok', "
                "election_id:1, "))
    def test_add_vote(self):
        """ Test the add_vote function. """
        create_elections(self.session)
        create_candidates(self.session)

        nuancierlib.add_vote(
            session=self.session,
            candidate_id=2,
            username='******'
        )

        self.session.commit()

        votes = nuancierlib.get_votes_user(self.session, 1, 'pingou')
        self.assertEqual(1, len(votes))
        self.assertEqual(2, votes[0].candidate_id)
Beispiel #36
0
    def test_generate_cache_cache_folder_is_file(self):
        """ Test the generate_cache function. """

        create_elections(self.session)
        election = nuancierlib.get_election(self.session, 2)

        stream = open(CACHE_FOLDER, 'w')
        stream.write('test')
        stream.close()

        self.assertRaises(nuancierlib.NuancierException,
                          nuancierlib.generate_cache,
                          session=self.session,
                          election=election,
                          picture_folder=PICTURE_FOLDER,
                          cache_folder=CACHE_FOLDER,
                          size=(128, 128))
    def test_add_candidate(self):
        """ Test the add_candidate function. """
        create_elections(self.session)

        nuancierlib.add_candidate(
            session=self.session,
            candidate_file='test.png',
            candidate_name='test image',
            candidate_author='pingou',
            election_id=2,
        )
        self.session.commit()

        candidates = nuancierlib.get_candidates(self.session, 2)
        self.assertEqual(1, len(candidates))
        self.assertEqual('test image', candidates[0].candidate_name)
        self.assertEqual('test.png', candidates[0].candidate_file)
    def test_generate_cache(self):
        """ Test the generate_cache function. """

        create_elections(self.session)
        election = nuancierlib.get_election(self.session, 2)

        self.assertFalse(os.path.exists(CACHE_FOLDER))

        nuancierlib.generate_cache(
            session=self.session,
            election=election,
            picture_folder=PICTURE_FOLDER,
            cache_folder=CACHE_FOLDER,
            size=(128, 128)
        )

        self.assertTrue(os.path.exists(CACHE_FOLDER))
Beispiel #39
0
    def test_elections_api_repr(self):
        """ Test the api_repr function of Elections. """
        create_elections(self.session)
        create_candidates(self.session)

        election = nuancierlib.get_election(self.session, 1)
        self.assertEqual(
            election.api_repr(1),
            {
                'date_end': TODAY - timedelta(days=8),
                'date_start': TODAY - timedelta(days=10),
                'id': 1,
                'name': u'Wallpaper F19',
                'submission_date_start': TODAY - timedelta(days=15),
                'year': 2013
            }
        )
    def test_generate_cache_cache_folder_is_file(self):
        """ Test the generate_cache function. """

        create_elections(self.session)
        election = nuancierlib.get_election(self.session, 2)

        stream = open(CACHE_FOLDER, 'w')
        stream.write('test')
        stream.close()

        self.assertRaises(
            nuancierlib.NuancierException,
            nuancierlib.generate_cache,
            session=self.session,
            election=election,
            picture_folder=PICTURE_FOLDER,
            cache_folder=CACHE_FOLDER,
            size=(128, 128)
        )
Beispiel #41
0
    def test_get_candidates(self):
        """ Test the get_candidates function. """
        create_elections(self.session)
        create_candidates(self.session)

        candidates = nuancierlib.get_candidates(self.session, 1, False)
        self.assertEqual(2, len(candidates))
        self.assertEqual('Image too narrow', candidates[0].candidate_name)
        self.assertEqual('Image ok', candidates[1].candidate_name)

        candidates = nuancierlib.get_candidates(self.session, 1, True)
        self.assertEqual(0, len(candidates))

        candidates = nuancierlib.get_candidates(self.session, 3, False)
        self.assertEqual(2, len(candidates))
        self.assertEqual('Image too small2.0', candidates[0].candidate_name)
        self.assertEqual('Image too small2.1', candidates[1].candidate_name)

        candidates = nuancierlib.get_candidates(self.session, 2, True)
        self.assertEqual(0, len(candidates))
Beispiel #42
0
    def test_candidates_repr(self):
        """ Test the __repr__ function of Candidates. """
        create_elections(self.session)
        create_candidates(self.session)

        candidate = nuancierlib.get_candidate(self.session, 1)
        if six.PY2:
            self.assertTrue(
                candidate.__repr__().startswith(
                    "Candidates(file:u'ok.JPG', "
                    "name:u'Image ok', "
                    "election_id:1, "
                )
            )
        else:
            self.assertTrue(
                candidate.__repr__().startswith(
                    "Candidates(file:'ok.JPG', "
                    "name:'Image ok', "
                    "election_id:1, "
                )
            )
Beispiel #43
0
    def test_get_candidates(self):
        """ Test the get_candidates function. """
        create_elections(self.session)
        create_candidates(self.session)

        candidates = nuancierlib.get_candidates(self.session, 1, False)
        self.assertEqual(2, len(candidates))
        self.assertEqual('Image too narrow', candidates[0].candidate_name)
        self.assertEqual('Image ok', candidates[1].candidate_name)

        candidates = nuancierlib.get_candidates(self.session, 1, True)
        self.assertEqual(0, len(candidates))

        candidates = nuancierlib.get_candidates(self.session, 3, False)
        self.assertEqual(4, len(candidates))
        self.assertEqual('Image too small2.0', candidates[0].candidate_name)
        self.assertEqual('Image too small2.1', candidates[1].candidate_name)
        self.assertEqual('Image too small2.2', candidates[2].candidate_name)
        self.assertEqual('Image too small2.3', candidates[3].candidate_name)

        candidates = nuancierlib.get_candidates(self.session, 2, True)
        self.assertEqual(0, len(candidates))
    def test_generate_cache_wrong_info_file(self):
        """ Test the generate_cache function. """

        create_elections(self.session)
        election = nuancierlib.get_election(self.session, 3)

        info_file = os.path.join(PICTURE_FOLDER, election.election_folder,
                                 'infos.txt')
        stream = open(info_file, 'w')
        stream.write('test')
        stream.close()

        self.assertRaises(
            nuancierlib.NuancierException,
            nuancierlib.generate_cache,
            session=self.session,
            election=election,
            picture_folder=PICTURE_FOLDER,
            cache_folder=CACHE_FOLDER,
            size=(128, 128)
        )

        os.unlink(info_file)
Beispiel #45
0
    def test_get_election(self):
        """ Test the get_election function. """
        create_elections(self.session)

        election = nuancierlib.get_election(self.session, 3)
        self.assertEqual('Wallpaper F21', election.election_name)
    def test_get_election(self):
        """ Test the get_election function. """
        create_elections(self.session)

        election = nuancierlib.get_election(self.session, 3)
        self.assertEqual('Wallpaper F21', election.election_name)