def test_combinations(self):
        entries = ShellmarkEntries(path=tmp_file())
        entries.add_entry(mark='dir1', path=DIR1)
        entries.add_entry(mark='dir2', path=DIR2)
        entries.add_entry(mark='dir3', path=DIR3)
        self.assertEqual(entries.get_entries(mark='dir3')[0].path, DIR3)

        # Delete one entry
        entries.delete_entries(mark='dir2')
        self.assertEqual(entries.get_entries(mark='dir3')[0].path, DIR3)

        # Sort
        entries.sort(reverse=True)
        self.assertEqual(entries.get_entries(mark='dir3')[0].path, DIR3)

        # Update one entry
        entries.update_entries(old_mark='dir1', new_path=DIR2)
        self.assertEqual(entries.get_entries(mark='dir3')[0].path, DIR3)

        entries.write()

        content = entries.get_raw()
        self.assertEqual(
            content,
            'export DIR_dir3="{0}/dir3"\nexport DIR_dir1="{0}/dir2"\n'.format(
                TEST_PATH))
 def test_method_update_entries_duplicates(self):
     entries = ShellmarkEntries(path=tmp_file())
     entries.add_entry(mark='dir1', path=DIR1)
     entries.add_entry(mark='dir1', path=DIR1)
     entries.add_entry(mark='dir1', path=DIR1)
     entries.update_entries(old_mark='dir1', new_mark='new1')
     self.assertEqual(entries._index['marks']['new1'], [0, 1, 2])
     self.assertEqual(entries._index['paths'][DIR1], [0, 1, 2])
 def test_method_update_entries(self):
     entries = ShellmarkEntries(path=os.path.join('test', 'files', 'sdirs'))
     entries.update_entries(old_mark='dir1', new_mark='new1')
     result = entries.get_entries(mark='new1')
     self.assertEqual(result[0].path, DIR1)