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

Add initial code for handling organizations.

(de)provisioning dashboards WIP.
Datasources still not implemented.
No tests implemented.
parent 29be76d3
No related branches found
No related tags found
No related merge requests found
setup.py 0 → 100644
from setuptools import setup, find_packages
setup(
name='brian-dashboard-manager',
version="0.1",
author='GEANT',
author_email='swd@geant.org',
description='',
url=('https://gitlab.geant.net/live-projects/brian-dashboard-manager/'),
packages=find_packages(),
install_requires=[
'requests',
'jsonschema',
'flask'
],
include_package_data=True,
)
import json
import os
import tempfile
import pytest
import brian_dashboard_manager
@pytest.fixture
def data_config_filename():
test_config_data = {
'str-param': 'test data string',
'int-param': -47
}
with tempfile.NamedTemporaryFile() as f:
f.write(json.dumps(test_config_data).encode('utf-8'))
f.flush()
yield f.name
@pytest.fixture
def client(data_config_filename):
os.environ['SETTINGS_FILENAME'] = data_config_filename
with brian_dashboard_manager.create_app().test_client() as c:
yield c
import json
import jsonschema
DEFAULT_REQUEST_HEADERS = {
'Content-type': 'application/json',
'Accept': ['application/json']
}
def test_version_request(client):
version_schema = {
'$schema': 'http://json-schema.org/draft-07/schema#',
'type': 'object',
'properties': {
'api': {
'type': 'string',
'pattern': r'\d+\.\d+'
},
'module': {
'type': 'string',
'pattern': r'\d+\.\d+'
}
},
'required': ['api', 'module'],
'additionalProperties': False
}
rv = client.post(
'version',
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
jsonschema.validate(
json.loads(rv.data.decode('utf-8')),
version_schema)
def test_test_proc1(client):
rv = client.post(
'test/test1',
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
result = json.loads(rv.data.decode('utf-8'))
assert result # boilerplate test ...
tox.ini 0 → 100644
[tox]
envlist = py36
[testenv]
deps =
coverage
flake8
-r requirements.txt
commands =
coverage erase
coverage run --source api -m py.test {posargs}
coverage xml
coverage html
coverage report --fail-under 85
flake8
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment