def validate_technologies(self, values): """Validate device technologies.""" allowed_tech = Technologies.get_technologies_names() for value in values: if value not in allowed_tech: raise ValidationError("Radio Access Technology can be {0} only".format(','.join(allowed_tech)), fields=['technologies'])
def test_get_technologies_names(session): """Verify that the get_technologies_names() return names of all technologies.""" techs = [ Technologies(id=12312, description='123 Tech'), Technologies(id=56712, description='567 Tech'), Technologies(id=89012, description='890 Tech') ] session.bulk_save_objects(techs) session.commit() for name in Technologies.get_technologies_names(): assert isinstance(name, str)