Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Warden
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pavel Valach
Warden
Commits
40f71541
Commit
40f71541
authored
2 years ago
by
Rajmund Hruška
Browse files
Options
Downloads
Patches
Plain Diff
Expose clients via API
parent
05c24209
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
warden_server/test_warden_server.py
+13
-0
13 additions, 0 deletions
warden_server/test_warden_server.py
warden_server/warden_server.py
+5
-0
5 additions, 0 deletions
warden_server/warden_server.py
with
18 additions
and
0 deletions
warden_server/test_warden_server.py
+
13
−
0
View file @
40f71541
...
@@ -142,6 +142,19 @@ class Warden3ServerTest(unittest.TestCase):
...
@@ -142,6 +142,19 @@ class Warden3ServerTest(unittest.TestCase):
status
,
_
,
_
=
Request
(
self
.
app
,
query
)()
status
,
_
,
_
=
Request
(
self
.
app
,
query
)()
self
.
assertEqual
(
status
,
expected_status
)
self
.
assertEqual
(
status
,
expected_status
)
def
test_getClients_interface
(
self
):
"""
Tests the getClients method invocation
"""
tests_common
=
[
(
"
/getClients?secret=abc
"
,
"
200 OK
"
),
(
"
/getClients?secret=abc&evil=false
"
,
"
200 OK
"
),
(
"
/getClients?client=dwadaw
"
,
"
403 I
'
m watching. Authenticate.
"
),
(
"
/getClients?client=asdf.blefub&secret=abc
"
,
"
403 I
'
m watching. Authenticate.
"
),
]
for
query
,
expected_status
in
tests_common
:
with
self
.
subTest
(
query
=
query
,
expected_status
=
expected_status
):
status
,
_
,
_
=
Request
(
self
.
app
,
query
)()
self
.
assertEqual
(
status
,
expected_status
)
def
test_getEvents_interface
(
self
):
# pylint: disable = locally-disabled, invalid-name
def
test_getEvents_interface
(
self
):
# pylint: disable = locally-disabled, invalid-name
"""
Tests the getEvents method invocation
"""
"""
Tests the getEvents method invocation
"""
tests_common
=
[
tests_common
=
[
...
...
This diff is collapsed.
Click to expand it.
warden_server/warden_server.py
+
5
−
0
View file @
40f71541
...
@@ -1630,6 +1630,11 @@ class WardenHandler(ObjectBase):
...
@@ -1630,6 +1630,11 @@ class WardenHandler(ObjectBase):
info
[
"
description
"
]
=
self
.
description
info
[
"
description
"
]
=
self
.
description
return
info
return
info
@expose
(
read
=
True
)
@json_wrapper
def
getClients
(
self
):
return
{
"
clients
"
:
self
.
db
.
get_clients
()}
@expose
(
read
=
True
)
@expose
(
read
=
True
)
@json_wrapper
@json_wrapper
def
getEvents
(
def
getEvents
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment