diff --git a/testsuite/objects/__init__.py b/testsuite/objects/__init__.py index 063e5f687..9fad13efe 100644 --- a/testsuite/objects/__init__.py +++ b/testsuite/objects/__init__.py @@ -78,11 +78,24 @@ class Credentials: def asdict(self): """Custom asdict because of needing to put location as parent dict key for inner dict""" - if self.in_location == "authorizationHeader": - return {self.in_location: {"prefix": self.keySelector}} + assert ( + self.in_location != "authorizationHeader" + ), "For 'authorizationHeader' please use CredentialsAuthHeader dataclass." return {self.in_location: {"name": self.keySelector}} +@dataclass +class CredentialsAuthHeader(Credentials): + """Dataclass for Credentials of type Authorization Header.""" + + def __post_init__(self): + assert self.in_location == "authorizationHeader" + + def asdict(self): + """Custom asdict because of needing to put location as parent dict key for inner dict""" + return {self.in_location: {"prefix": self.keySelector}} + + @dataclass class Rule: """