def test_sync_roms_for_user_sets_managed_ids(self):
    shortcut1 = Shortcut("Game1", "/Path/to/game1", "/Path/to", "")
    shortcut2 = Shortcut("Game2", "/Path/to/game2", "/Path/to", "")

    rom1 = mock.MagicMock()
    rom1.to_shortcut.return_value = shortcut1
    rom2 = mock.MagicMock()
    rom2.to_shortcut.return_value = shortcut2

    self.synchronizer.sync_roms_for_user(self.mock_user, [rom1, rom2])

    new_managed_ids = [shortcut1.appid(), shortcut2.appid()]
    self.mock_archive.set_managed_ids.assert_called_with(self.mock_user, new_managed_ids)
示例#2
0
    def test_sync_roms_for_user_sets_managed_ids(self):
        shortcut1 = Shortcut("Game1", "/Path/to/game1", "/Path/to", "")
        shortcut2 = Shortcut("Game2", "/Path/to/game2", "/Path/to", "")

        rom1 = mock.MagicMock()
        rom1.to_shortcut.return_value = shortcut1
        rom2 = mock.MagicMock()
        rom2.to_shortcut.return_value = shortcut2

        self.synchronizer.sync_roms_for_user(self.mock_user, [rom1, rom2])

        new_managed_ids = [shortcut1.appid(), shortcut2.appid()]
        self.mock_archive.set_managed_ids.assert_called_with(
            self.mock_user, new_managed_ids)
  def test_sync_roms_for_user_sets_managed_ids(self):
    shortcut1 = Shortcut("Game1", "/Path/to/game1", "/Path/to", "")
    shortcut2 = Shortcut("Game2", "/Path/to/game2", "/Path/to", "")

    rom1 = mock()
    when(rom1).to_shortcut().thenReturn(shortcut1)
    rom2 = mock()
    when(rom2).to_shortcut().thenReturn(shortcut2)

    self.mock_user.shortcuts = []

    self.synchronizer.sync_roms_for_user(self.mock_user, [rom1, rom2], None)

    new_managed_ids = [shortcut1.appid(), shortcut2.appid()]
    verify(self.mock_archive).set_managed_ids(self.mock_user, new_managed_ids)
 def test_unmanaged_shortcuts_doesnt_return_shortcut_with_appid_in_managed_ids(self):
   managed_shortcut = Shortcut("Game", "/Path/to/game", "/Path/to", "")
   random_shortcut = Shortcut("Plex", "/Some/Random/Path/plex", "/Some/Random/Path")
   managed_ids = [managed_shortcut.appid()]
   shortcuts = [managed_shortcut, random_shortcut]
   unmanaged = self.synchronizer.unmanaged_shortcuts(managed_ids,shortcuts, None)
   self.assertEquals(unmanaged, [random_shortcut])
示例#5
0
    def test_sync_roms_for_user_sets_managed_ids(self):
        shortcut1 = Shortcut("Game1", "/Path/to/game1", "/Path/to", "")
        shortcut2 = Shortcut("Game2", "/Path/to/game2", "/Path/to", "")

        rom1 = mock()
        when(rom1).to_shortcut().thenReturn(shortcut1)
        rom2 = mock()
        when(rom2).to_shortcut().thenReturn(shortcut2)

        self.mock_user.shortcuts = []

        self.synchronizer.sync_roms_for_user(self.mock_user, [rom1, rom2],
                                             None)

        new_managed_ids = [shortcut1.appid(), shortcut2.appid()]
        verify(self.mock_archive).set_managed_ids(self.mock_user,
                                                  new_managed_ids)
示例#6
0
 def test_unmanaged_shortcuts_doesnt_return_shortcut_with_appid_in_managed_ids(
         self):
     managed_shortcut = Shortcut("Game", "/Path/to/game", "/Path/to", "")
     random_shortcut = Shortcut("Plex", "/Some/Random/Path/plex",
                                "/Some/Random/Path")
     managed_ids = [managed_shortcut.appid()]
     shortcuts = [managed_shortcut, random_shortcut]
     unmanaged = self.synchronizer.unmanaged_shortcuts(
         managed_ids, shortcuts)
     self.assertEquals(unmanaged, [random_shortcut])