def test_init(self): thing1 = self.get_thing() assert (thing1.id == 'stac') assert (len(thing1.links()) == 3) assert (len(thing1.links('self')) == 1) data = thing1.data del data['links'] thing2 = Thing(data) assert (thing2.links() == []) with self.assertRaises(STACError): thing2.save() print(thing1)
def get_thing(self): """ Configure testing class """ with open(self.fname) as f: data = json.loads(f.read()) return Thing(data)
def test_init_error(self): with self.assertRaises(STACError): Thing({})