def test_get_unit_types(self): unit_types_model = UnitType(db=self.db) unit_types = unit_types_model.get_unit_types() self.assertIsInstance(unit_types, list) self.assertTrue(len(unit_types) > 0) for unit_type in unit_types: self.assertIsInstance(unit_type, dict) self.assertTrue("id" in unit_type) self.assertTrue("name" in unit_type)
def _build_unit_types(self): self.log.info("Building unit types") unit_type_model = UnitTypeModel(db=self.db) unit_types = unit_type_model.get_unit_types() unit_type_collection = UnitTypeCollection() if unit_types: for ut in unit_types: unit_type = UnitType(unit_type=ut) unit_type_collection.add(unit_type) return unit_type_collection