Beispiel #1
0
 def test_end_solo_dict_restores_previous_state(self):
     toggle_dict(self.engine, '-main.json')
     solo_dict(self.engine, '+spanish/main.json')
     end_solo_dict(self.engine, '')
     self.assertEqual(self.engine.config['dictionaries'], [
         self.user,
         self.commands,
         self.english.replace(enabled=False),
         self.spanish,
     ])
Beispiel #2
0
 def test_end_solo_dict_without_first_doing_solo_2(self):
     backup_dictionary_stack([
         self.extra,
         self.english.replace(enabled=False),
     ], pdc.BACKUP_DICTIONARY_PATH)
     end_solo_dict(self.engine, '')
     self.assertEqual(self.engine.config['dictionaries'], [
         self.user,
         self.commands,
         self.english.replace(enabled=False),
         self.spanish,
     ])
Beispiel #3
0
 def test_end_solo_dict_doesnt_delete_new_dictionaries(self):
     solo_dict(self.engine, '+spanish/main.json')
     # ...then load a new dictionary while in the temporary mode
     dictionaries = self.engine.config['dictionaries']
     dictionaries.append(self.extra)
     self.engine.config = {'dictionaries': dictionaries}
     end_solo_dict(self.engine, '')
     self.assertEqual(self.engine.config['dictionaries'], [
         self.user,
         self.commands,
         self.english,
         self.spanish,
         self.extra,
     ])
     pass
Beispiel #4
0
    def test_backed_up_dictionaries_restored_after_solo_if_backup_exists(self):
        toggle_dict(self.engine, '-main.json')  #turned off before backup...
        original_dictionaries = self.engine.config['dictionaries']
        backup_dictionary_stack(original_dictionaries,
                                pdc.BACKUP_DICTIONARY_PATH)
        toggle_dict(self.engine, '+main.json')  #but normal before solo_dict

        #Now that there's a backup file, do the first solo_dict since we've run...
        solo_dict(self.engine, '+spanish/main.json')
        end_solo_dict(self.engine, '')

        self.assertEqual(
            self.engine.config['dictionaries'],
            [
                self.user,
                self.commands,
                self.english.replace(
                    enabled=False),  # turned back off again after restore
                self.spanish,
            ])