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)
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"))