Пример #1
0
    def test_basic_io(self):
        '''UserPreferences: create prefs, write them, read them'''
        mid = "ThisIsMyNotSoAutomatedGeneratedId"
        tdir = tempfile.mkdtemp()

        up = UserPreferences(tdir)
        up.set_value("stats", "id", mid)
        up.write()
        
        upr = UserPreferences(tdir)
        upr.read()
        val = upr.get_value("stats", "id")
        
        shutil.rmtree(tdir)
        
        self.assertEqual(mid, val)
        
Пример #2
0
    def test_basic_io(self):
        '''UserPreferences: create prefs, write them, read them'''
        mid = "ThisIsMyNotSoAutomatedGeneratedId"
        tdir = tempfile.mkdtemp()

        up = UserPreferences(tdir)
        up.set_value("stats", "id", mid)
        up.write()

        upr = UserPreferences(tdir)
        upr.read()
        val = upr.get_value("stats", "id")

        shutil.rmtree(tdir)

        self.assertEqual(mid, val)
Пример #3
0
 def test_get_nonex_value(self):
     '''UserPreferences: Get a non existing value'''
     up = UserPreferences()
     self.assertRaises(KeyError, up.get_value, "dasIst", "nicht,da")
Пример #4
0
 def test_add_new_value(self):
     '''UserPreferences: add new value to preferences.'''
     mid = "ThisIsMyNotSoAutomatedGeneratedId"
     up = UserPreferences()
     up.set_value("stats", "id", mid)
     self.assertEqual(mid, up.get_value("stats", "id"))
Пример #5
0
 def test_default_rmtoo_home_dir(self):
     '''UserPreferences: check if the default rmtoo home dir works.'''
     up = UserPreferences()
     self.assertEqual(os.path.expanduser("~/.rmtoo"),
                      up.get_rmtoo_home_dir())
Пример #6
0
 def test_set_rmtoo_home_dir(self):
     '''UserPreferences: check if the rmtoo home dir is set correctly.'''
     up = UserPreferences("/tmp/my/path")
     self.assertEqual("/tmp/my/path", up.get_rmtoo_home_dir())
Пример #7
0
 def test_add_new_value(self):
     '''UserPreferences: add new value to preferences.'''
     mid = "ThisIsMyNotSoAutomatedGeneratedId"
     up = UserPreferences()
     up.set_value("stats", "id", mid)
     self.assertEqual(mid, up.get_value("stats", "id"))
Пример #8
0
 def test_default_rmtoo_home_dir(self):
     '''UserPreferences: check if the default rmtoo home dir works.'''
     up = UserPreferences()
     self.assertEqual(os.path.expanduser("~/.rmtoo"), 
                      up.get_rmtoo_home_dir())
Пример #9
0
 def test_set_rmtoo_home_dir(self):
     '''UserPreferences: check if the rmtoo home dir is set correctly.'''
     up = UserPreferences("/tmp/my/path")
     self.assertEqual("/tmp/my/path", up.get_rmtoo_home_dir())