Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
brian-dashboard-manager
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
geant-swd
brian
brian-dashboard-manager
Commits
efef8547
Commit
efef8547
authored
2 years ago
by
Bjarke Madsen
Browse files
Options
Downloads
Patches
Plain Diff
tests
parent
4ed09a3b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
test/conftest.py
+10
-0
10 additions, 0 deletions
test/conftest.py
test/data/services.json
+13715
-0
13715 additions, 0 deletions
test/data/services.json
test/test_services.py
+19
-0
19 additions, 0 deletions
test/test_services.py
test/test_update.py
+6
-0
6 additions, 0 deletions
test/test_update.py
with
13750 additions
and
0 deletions
test/conftest.py
+
10
−
0
View file @
efef8547
...
...
@@ -12,6 +12,7 @@ def data_config():
"
admin_password
"
:
"
fakeadmin
"
,
"
hostname
"
:
"
myfakehostname.org
"
,
"
inventory_provider
"
:
"
http://inventory-provider01.geant.org:8080
"
,
"
reporting_provider
"
:
"
http://hgf-reporting-provider.geant.org:1337
"
,
"
organizations
"
:
[
{
"
name
"
:
"
Testorg1
"
,
...
...
@@ -50,6 +51,15 @@ def data_config():
}
def
_test_data
(
filename
):
data_filename
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
data
'
,
filename
)
with
open
(
data_filename
)
as
f
:
return
json
.
loads
(
f
.
read
())
@pytest.fixture
def
data_config_filename
(
data_config
):
with
tempfile
.
NamedTemporaryFile
()
as
f
:
...
...
This diff is collapsed.
Click to expand it.
test/data/services.json
0 → 100644
+
13715
−
0
View file @
efef8547
This diff is collapsed.
Click to expand it.
test/test_services.py
0 → 100644
+
19
−
0
View file @
efef8547
import
responses
from
brian_dashboard_manager.services.api
import
fetch_services
from
brian_dashboard_manager.templating.services
import
create_service_panels
from
conftest
import
_test_data
@responses.activate
def
test_services
(
data_config
,
client
):
responses
.
add
(
method
=
responses
.
GET
,
url
=
f
"
{
data_config
[
'
reporting_provider
'
]
}
/scid/current
"
,
json
=
_test_data
(
'
services.json
'
))
services
=
fetch_services
(
data_config
[
'
reporting_provider
'
])
dashboards
=
list
(
create_service_panels
(
services
,
'
testdatasource
'
))
assert
dashboards
This diff is collapsed.
Click to expand it.
test/test_update.py
+
6
−
0
View file @
efef8547
...
...
@@ -3,6 +3,7 @@ import json
from
brian_dashboard_manager.grafana.provision
import
provision_folder
,
\
provision
from
conftest
import
_test_data
TEST_INTERFACES
=
[
{
...
...
@@ -661,6 +662,11 @@ def test_provision_folder(data_config, mocker):
@responses.activate
def
test_provision
(
data_config
,
mocker
,
client
):
responses
.
add
(
method
=
responses
.
GET
,
url
=
f
"
{
data_config
[
'
reporting_provider
'
]
}
/scid/current
"
,
json
=
_test_data
(
'
services.json
'
))
responses
.
add
(
method
=
responses
.
GET
,
url
=
f
"
{
data_config
[
'
inventory_provider
'
]
}
/poller/interfaces
"
,
...
...
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