class ZipkinConfig(config.Config): host = config.StrField(default="localhost", env="ZIPKIN_HOST") port = config.IntField(default=9411, env="ZIPKIN_PORT") enabled = config.BoolField(default=False, env="ZIPKIN_ENABLED") def get_address(self) -> str: return f"http://{self.host}:{self.port}/api/v2/spans"
def test_normalize_failed(self, payload): field = config.IntField(default=0) with pytest.raises(config.InvalidField): field.normalize(payload)
class ConsulConfig(config.Config): host = config.StrField(default="localhost", env="CONSUL_HOST") port = config.IntField(default=8500, env="CONSUL_PORT")
def test_normalize(self, payload): field = config.IntField(default=0) normalized = field.normalize(payload) assert normalized == 5432