예제 #1
0
    def test_get_and_set_shortcuts_creates_file_at_correct_path(self):
        tempdir = tempfile.mkdtemp()

        steam = model.Steam(tempdir)
        context = model.LocalUserContext(steam=steam, user_id='anonymous')
        # Create the `anonymous` directory, cause we can't open shortcuts.vdf for
        # writing if the containing directory doesn't exist
        os.makedirs(paths.user_config_directory(context))

        self.assertFalse(os.path.exists(paths.shortcuts_path(context)))
        self.assertEqual([], shortcuts.get_shortcuts(context))

        updated_shortcuts = [_dummy_shortcut()]
        shortcuts.set_shortcuts(context, updated_shortcuts)
        self.assertEqual(updated_shortcuts, shortcuts.get_shortcuts(context))

        shutil.rmtree(tempdir)
예제 #2
0
 def user_shortcuts(self, uid):
     context = model.LocalUserContext(self.steam_fixture.get_steam(), uid)
     return shortcuts.get_shortcuts(context)
예제 #3
0
 def set_user_shortcuts(self, uid, new_shortcuts):
     context = model.LocalUserContext(self.steam_fixture.get_steam(), uid)
     return shortcuts.set_shortcuts(context, new_shortcuts)
예제 #4
0
 def get_context(self):
     return steam_model.LocalUserContext(self.steam_fixture.get_steam(),
                                         self.uid)
예제 #5
0
 def setUp(self):
     self.tempdir = tempfile.mkdtemp()
     s = model.Steam(self.tempdir)
     self.context = model.LocalUserContext(s, '1234')
     os.makedirs(paths.custom_images_directory(self.context))