Exemplo n.º 1
0
    def test_create_giant_list(self):
        filename = 'america_9s.txt.gz'
        path = os.path.join(settings.PROJECT_ROOT, 'wordwalls', 'tests',
                            'files', filename)
        user = User.objects.get(username='******')
        with gzip.open(path, 'rb') as f:
            contents = f.read()
        create_user_list(contents, 'america_9s.txt',
                         Lexicon.objects.get(lexiconName='America'), user)
        logger.debug(WordList.objects.all())
        wl = WordList.objects.get(name='america_9s')
        self.assert_wl(wl, {
            'numAlphagrams': 28291, 'numCurAlphagrams': 28291,
            'numFirstMissed': 0, 'numMissed': 0, 'goneThruOnce': False,
            'questionIndex': 0, 'is_temporary': False
        })

        # Check that it added to total. 55781 is the old value, in
        # profiles.json
        self.assertEqual(user.aerolithprofile.wordwallsSaveListSize,
                         55781 + 28291)
Exemplo n.º 2
0
    def test_create_spanish_list(self):
        filename = 'spanish_words.txt'
        path = os.path.join(settings.PROJECT_ROOT, 'wordwalls', 'tests',
                            'files', filename)
        user = User.objects.get(username='******')
        f = codecs.open(path, 'r', 'utf-8')
        contents = f.read()
        f.close()
        logger.debug(create_user_list(
            contents, filename,
            Lexicon.objects.get(lexiconName='FISE09'), user))
        logger.debug(WordList.objects.all())
        wl = WordList.objects.get(name='spanish_words')
        self.assert_wl(wl, {
            'numAlphagrams': 3, 'numCurAlphagrams': 3, 'numFirstMissed': 0,
            'numMissed': 0, 'goneThruOnce': False, 'questionIndex': 0,
            'is_temporary': False
        })

        # Check that it added to total. 55781 is the old value, in
        # profiles.json
        self.assertEqual(user.aerolithprofile.wordwallsSaveListSize,
                         55781 + 3)
        f.close()