Skip to content

Commit

Permalink
Merge pull request #275 from elixir-luxembourg/develop
Browse files Browse the repository at this point in the history
develop to master (1.6.0)
  • Loading branch information
vildead authored Sep 14, 2021
2 parents 0f60f83 + a94e096 commit 93fe4a9
Show file tree
Hide file tree
Showing 96 changed files with 2,392 additions and 1,033 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Execute the tests

on:
push:
branches:
- use-github-actions
- master
- develop
- dependabot/**
pull_request:
branches:
- develop
- master

jobs:
tests:
timeout-minutes: 15
runs-on: ubuntu-latest

steps:
- name: Checkout the repository
uses: actions/checkout@v2

- name: Prepare DAISY settings for CI
run: cp elixir_daisy/settings_compose_ci.py elixir_daisy/settings_compose.py

- name: Build and start containers
run: docker-compose up -d --build

- name: Execute the tests
run: docker-compose exec -T web python setup.py pytest

- name: Stop containers
if: always()
run: docker-compose down
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ language: python

python:
- "3.6"
- "3.5"

services:
- docker
Expand All @@ -18,4 +17,9 @@ install:
- sleep 60

script:
- docker-compose exec web python setup.py pytest
- docker-compose exec web python setup.py pytest

branches:
only:
- master
- develop
8 changes: 8 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ def user_data_steward(django_user_model):
return u


@pytest.fixture
def user_admin(django_user_model):
u = django_user_model.objects.create_superuser(username="test.admin",
email="test.admin@mail.com",
password="password")
return u


@pytest.fixture
def users(django_user_model, user_normal, user_vip, user_data_steward):
"""
Expand Down
19 changes: 18 additions & 1 deletion core/apps.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
from django.apps import AppConfig
from django.conf import settings
import os
import json
from django.core.exceptions import ImproperlyConfigured


class CoreConfig(AppConfig):
name = 'core'

def ready(self):
import core.models.signals
import core.models.signals

# Prevent use of conflicting versions of import JSON schemas
json_schema_uri = getattr(settings,'IMPORT_JSON_SCHEMAS_URI')
json_schema_dir = getattr(settings,'IMPORT_JSON_SCHEMAS_DIR')
for file in os.listdir(json_schema_dir):
with open(os.path.join(json_schema_dir, file), 'r', encoding='utf-8') as schema_file:
schema = json.loads(schema_file.read())
local_schema_uri_basename = os.path.dirname(schema['$id'])
settings_schema_uri_basename = os.path.dirname(json_schema_uri)
if local_schema_uri_basename != settings_schema_uri_basename:
raise ImproperlyConfigured('Version of import JSON schema is not matching version set in settings.py.\n'
f'{file} property $id: {local_schema_uri_basename}\n'
f'settings.py schema URI: {settings_schema_uri_basename}')
17 changes: 17 additions & 0 deletions core/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ def __repr__(self):
return "{}({!r})".format(self.__class__.__name__, msg)


class PartnerImportError(DaisyError):
"""Error when importing partner into daisy."""

default_message = "Error when importing partner:' {data}'"

def __init__(self, data, msg=None):
self.data = data
super().__init__(msg=msg)


class DatasetImportError(DaisyError):
Expand All @@ -28,6 +36,15 @@ def __init__(self, data, msg=None):
super().__init__(msg=msg)


class ProjectImportError(DaisyError):
"""Error when importing project into daisy."""

default_message = "Error when importing project:' {data}'"

def __init__(self, data, msg=None):
self.data = data
super().__init__(msg=msg)


class FixtureImportError(DaisyError):
"""Error when importing initial definition data into daisy."""
Expand Down
59 changes: 32 additions & 27 deletions core/fixtures/document-types.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
[
{
"name": "Other"
},

{
"name": "Contract/Agreement"
},
{
"name": "Consent Form Template"
},
{
"name": "CNER Approval"
},
{
"name": "CNPD Authorisation"
},
{
"name": "CNPD Notification"
},
{
"name": "ERP Approval"
},
{
"name": "Subject Information Sheet Template"
}
]
[{
"name": "Other"
},

{
"name": "Data Protection Impact Assessment"
},

{
"name": "Contract/Agreement"
},
{
"name": "Consent Form Template"
},
{
"name": "CNER Approval"
},
{
"name": "CNPD Authorisation"
},
{
"name": "CNPD Notification"
},


{
"name": "ERP Approval"
},
{
"name": "Subject Information Sheet Template"
}
]
16 changes: 8 additions & 8 deletions core/fixtures/elu-cohorts.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"elu_accession": "ELU_C_1",
"external_id": "ELU_C_1",
"title": "LuxPARK",
"owners": [
"Rejko Kr\u00fcger"
Expand All @@ -14,7 +14,7 @@
]
},
{
"elu_accession": "ELU_C_2",
"external_id": "ELU_C_2",
"title": "MUST (Diabetes MUltiplex family STudy)",
"owners": [
"Carine de Beaufort"
Expand All @@ -27,7 +27,7 @@
]
},
{
"elu_accession": "ELU_C_3",
"external_id": "ELU_C_3",
"title": "COSMIC (Colonisation, Succession and Evolution of Human Gastrointestinal Microbiome from Birth to Infancy)",
"owners": [
"Carine de Beaufort"
Expand All @@ -40,7 +40,7 @@
]
},
{
"elu_accession": "ELU_C_4",
"external_id": "ELU_C_4",
"title": "DeNoPa (De Novo Parkinson Longitudinal Study)",
"owners": [
"Brit Mollenhauer"
Expand All @@ -51,7 +51,7 @@
]
},
{
"elu_accession": "ELU_C_5",
"external_id": "ELU_C_5",
"title": "TREND (T\u00fbbinger evaluation of Risk factors for Early detection of NeuroDegeneration.)",
"owners": [
"Daniela Berg"
Expand All @@ -62,23 +62,23 @@
]
},
{
"elu_accession": "ELU_C_6",
"external_id": "ELU_C_6",
"title": "ADNI (Alzheimer's Disease Neuroimaging Initiative.)",
"comments": "...TBD...",
"institutes": [
"ELU_I_84"
]
},
{
"elu_accession": "ELU_C_7",
"external_id": "ELU_C_7",
"title": "PPMI (Partkinsons Progressive Markers Inititative Study Cohort.)",
"comments": "...TBD...",
"institutes": [
"ELU_I_85"
]
},
{
"elu_accession": "ELU_C_8",
"external_id": "ELU_C_8",
"title": "Supercentenarians (Betterhumans Inc. Supercentenarians Research Study)",
"comments": "...TBD...",
"institutes": [
Expand Down
Loading

0 comments on commit 93fe4a9

Please sign in to comment.