Skip to content
Snippets Groups Projects
Commit efef8547 authored by Bjarke Madsen's avatar Bjarke Madsen
Browse files

tests

parent 4ed09a3b
Branches
Tags
No related merge requests found
......@@ -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.
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
......@@ -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",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment