'Create the following folder hierarchy:
root
|--foo
|   |-bar
|--bar
and try to move the owter bar in foo. This has to fail since it would result
in two folders with the same name and parent.'

def test_validate_no_duplicate_folders_on_move(self):

    root = Folder.objects.create(name='root', owner=self.superuser)
    foo = Folder.objects.create(name='foo', parent=root, owner=self.superuser)
    bar = Folder.objects.create(name='bar', parent=root, owner=self.superuser)
    foos_bar = Folder.objects.create(name='bar', parent=foo, owner=self.superuser)
    url = reverse('admin:filer-directory_listing', kwargs={'folder_id': root.pk})
    response = self.client.post(url, {'action': 'move_files_and_folders', 'post': 'yes', 'destination': foo.pk, helpers.ACTION_CHECKBOX_NAME: ('folder-%d' % (bar.pk,))})
    bar = Folder.objects.get(pk=bar.pk)
    self.assertEqual(bar.parent.pk, root.pk)
