def test_get_node_by_path(self):
        """Test get_node_by_path."""
        root_id = self.root.id
        dir1 = self.vgw.make_subdirectory(root_id, 'dir1')
        file1 = self.vgw.make_file(root_id, 'file1.txt')
        dir2 = self.vgw.make_subdirectory(dir1.id, 'dir2')
        file2 = self.vgw.make_file(dir1.id, 'file2.mp3')
        dir3 = self.vgw.make_subdirectory(dir2.id, 'dir3')
        file3 = self.vgw.make_file(dir2.id, 'file3.mp3')
        # make sure content and mimetype still work correctly
        hash = self.factory.get_fake_hash()
        key = uuid.uuid4()
        self.vgw.make_file_with_content(
            dir3.id, 'file4.tif', hash, 123, 100, 1000, key,
            mimetype='image/tif')
        # filename with a space in it
        file5 = self.vgw.make_file(root_id, 'space! ')
        # the basic use cases
        r = self.vgw.get_node_by_path('/')
        self.assertEqual(r.id, root_id)
        d1 = self.vgw.get_node_by_path('/dir1')
        self.assertEqual(d1.id, dir1.id)
        f1 = self.vgw.get_node_by_path('/file1.txt')
        self.assertEqual(f1.id, file1.id)
        d2 = self.vgw.get_node_by_path('/dir1/dir2')
        self.assertEqual(d2.id, dir2.id)
        f2 = self.vgw.get_node_by_path('/dir1/file2.mp3')
        self.assertEqual(f2.id, file2.id)
        d3 = self.vgw.get_node_by_path(
            '/dir1/dir2/dir3', kind=StorageObject.DIRECTORY)
        self.assertEqual(d3.id, dir3.id)
        f3 = self.vgw.get_node_by_path('/dir1/dir2/file3.mp3')
        self.assertEqual(f3.id, file3.id)
        f5 = self.vgw.get_node_by_path('/space! ')
        self.assertEqual(f5.id, file5.id)
        # object accessable without inital / path
        d1 = self.vgw.get_node_by_path('dir1')
        self.assertEqual(d1.id, dir1.id)
        f1 = self.vgw.get_node_by_path('file1.txt', kind=StorageObject.FILE)
        self.assertEqual(f1.id, file1.id)
        d2 = self.vgw.get_node_by_path('dir1/dir2')
        self.assertEqual(d2.id, dir2.id)
        d3 = self.vgw.get_node_by_path('dir1/dir2/dir3')
        self.assertEqual(d3.id, dir3.id)
        # the standard node finder options work as well
        f4 = self.vgw.get_node_by_path('/dir1/dir2/dir3/file4.tif',
                                       with_content=True)
        self.assertEqual(f4.content.storage_key, key)
        # invalid paths get StorageErrors
        self.assertRaises(errors.StorageError, self.vgw.get_node_by_path, '')
        self.assertRaises(errors.StorageError, self.vgw.get_node_by_path, ' ')
        # test DoesNotExistCondtions
        self.assertRaises(
            errors.DoesNotExist,
            self.vgw.get_node_by_path, '/X..Y/')
        self.assertRaises(
            errors.DoesNotExist,
            self.vgw.get_node_by_path, '/dir1', kind=StorageObject.FILE)
        self.assertRaises(
            errors.DoesNotExist, self.vgw.get_node_by_path, '/file1.txt',
            kind=StorageObject.DIRECTORY)