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_sort(self):
        sdirs = tmp_file()
        entries = ShellmarkEntries(path=sdirs)
        entries.add_entry(mark='dir3', path=DIR1)
        entries.add_entry(mark='dir2', path=DIR2)
        entries.add_entry(mark='dir1', path=DIR3)
        self.assertEqual(entries.entries[0].mark, 'dir3')
        self.assertEqual(entries.entries[1].mark, 'dir2')
        self.assertEqual(entries.entries[2].mark, 'dir1')
        self.assertEqual(entries.entries[0].path, DIR1)
        self.assertEqual(entries.entries[1].path, DIR2)
        self.assertEqual(entries.entries[2].path, DIR3)

        entries.sort()
        self.assertEqual(entries.entries[0].mark, 'dir1')
        self.assertEqual(entries.entries[1].mark, 'dir2')
        self.assertEqual(entries.entries[2].mark, 'dir3')

        entries.sort(reverse=True)
        self.assertEqual(entries.entries[0].mark, 'dir3')
        self.assertEqual(entries.entries[1].mark, 'dir2')
        self.assertEqual(entries.entries[2].mark, 'dir1')

        entries.sort(attribute_name='path')
        self.assertEqual(entries.entries[0].path, DIR1)
        self.assertEqual(entries.entries[1].path, DIR2)
        self.assertEqual(entries.entries[2].path, DIR3)

        entries.sort(attribute_name='path', reverse=True)
        self.assertEqual(entries.entries[0].path, DIR3)
        self.assertEqual(entries.entries[1].path, DIR2)
        self.assertEqual(entries.entries[2].path, DIR1)