-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add authenticate_response model
- Loading branch information
1 parent
0efdc56
commit e0ea838
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# SPDX-FileCopyrightText: 2024-present linuxdaemon <linuxdaemon.irc@gmail.com> | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
from pydantic_xml import attr, element | ||
|
||
from gvm_sync_targets.models.model import Model | ||
|
||
|
||
class AuthenticateResponse(Model, tag="authenticate_response"): | ||
status: int = attr("status") | ||
status_text: str = attr("status_text") | ||
|
||
role: str = element() | ||
timezone: str = element() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# SPDX-FileCopyrightText: 2024-present linuxdaemon <linuxdaemon.irc@gmail.com> | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
from gvm_sync_targets.models import AuthenticateResponse | ||
|
||
data = """ | ||
<authenticate_response status="200" status_text="OK"> | ||
<role>Admin</role> | ||
<timezone>UTC</timezone> | ||
</authenticate_response> | ||
""" | ||
|
||
|
||
def test_auth_response(): | ||
model = AuthenticateResponse.from_xml(data) | ||
assert model.role == "Admin" | ||
assert model.timezone == "UTC" |