Exemplo n.º 1
0
 def test_asset_absolute_href(self) -> None:
     item_dict = self.get_example_item_dict()
     item = Item.from_dict(item_dict)
     rel_asset = Asset("./data.geojson")
     rel_asset.set_owner(item)
     expected_href = os.path.abspath("./data.geojson")
     actual_href = rel_asset.get_absolute_href()
     self.assertEqual(expected_href, actual_href)
Exemplo n.º 2
0
 def test_asset_absolute_href(self):
     item_dict = self.get_example_item_dict()
     item = Item.from_dict(item_dict)
     rel_asset = Asset('./data.geojson')
     rel_asset.set_owner(item)
     expected_href = 'http://cool-sat.com/catalog/CS3-20160503_132130_04/data.geojson'
     actual_href = rel_asset.get_absolute_href()
     self.assertEqual(expected_href, actual_href)
Exemplo n.º 3
0
    def test_asset_absolute_href_no_item_self(self) -> None:
        item_dict = self.get_example_item_dict()
        item = Item.from_dict(item_dict)
        assert item.get_self_href() is None

        rel_asset = Asset("./data.geojson")
        rel_asset.set_owner(item)
        actual_href = rel_asset.get_absolute_href()
        self.assertEqual(None, actual_href)
Exemplo n.º 4
0
 def test_asset_absolute_href(self):
     m = TestCases.get_path(
         'data-files/itemcollections/sample-item-collection.json')
     with open(m) as f:
         item_dict = json.load(f)['features'][0]
     item = Item.from_dict(item_dict)
     rel_asset = Asset('./data.geojson')
     rel_asset.set_owner(item)
     expected_href = 'http://cool-sat.com/catalog/CS3-20160503_132130_04/data.geojson'
     actual_href = rel_asset.get_absolute_href()
     self.assertEqual(expected_href, actual_href)
Exemplo n.º 5
0
 def test_asset_absolute_href(self) -> None:
     item_path = TestCases.get_path("data-files/item/sample-item.json")
     item_dict = self.get_example_item_dict()
     item = Item.from_dict(item_dict)
     item.set_self_href(item_path)
     rel_asset = Asset("./data.geojson")
     rel_asset.set_owner(item)
     expected_href = os.path.abspath(
         os.path.join(os.path.dirname(item_path), "./data.geojson"))
     actual_href = rel_asset.get_absolute_href()
     self.assertEqual(expected_href, actual_href)