def setup(self): self.dpkg = datapackage.DataPackage("tests/test.dpkg") kwargs = self.dpkg['resources'][0] kwargs['datapackage_uri'] = compat.str(self.dpkg.base) self.resource = datapackage.Resource(**kwargs)
def test_get_default_name(self): """Try reading the default resource name""" del self.resource['name'] assert self.resource.name == compat.str('')
def test_set_name(self): """Try setting the resource name""" self.resource.name = compat.str("barfoo") assert self.resource.name == "barfoo"
def test_set_url(self): """Try setting the resource url""" self.resource.url = compat.str("https://www.google.com") assert self.resource.url == "https://www.google.com",\ self.resource.url
def test_set_bad_url(self): """Try setting the resource url to an invalid url""" self.resource.url = compat.str("google")
def test_set_path(self): """Check that setting the path works""" self.resource.path = compat.str("barfoo.json") assert self.resource.path == "barfoo.json" assert self.resource.fullpath == posixpath.join( self.dpkg.base, "barfoo.json")
def test_set_path(self): """Check that setting the path works""" self.resource.path = compat.str("barfoo.json") assert self.resource.path == "barfoo.json" assert self.resource.fullpath == posixpath.join(self.dpkg.base, "barfoo.json")