Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
trigger:
- feature/azure-pipelines

pool:
vmImage: 'Ubuntu-18.04'

variables:
# imageName: 'unicef/donor-reporting-portal-backend'
imageName: 'scs-drp-be'
dockerHub: 'uniwebsscsdrpdev'
DATABASE_URL: 'psql://postgres:pass@postgres:5432/donor_reporting_portal'
HOST: 'http://localhost:8082'
SECRET_KEY: 'top-secret'
INSIGHT_URL: 'https://uniapis.unicef.org/biapi/v1/'
POSTGRES_USER: postgres
POSTGRES_PASSWORD: pass
POSTGRES_DB: donor_reporting_portal

container:
image: postgres:12-alpine
options: --hostname container-test --ip 192.168.0.1
ports:
- 8080:80
- 5432

strategy:
matrix:
Python38:
python.version: '3.8'

steps:
- task: UsePythonVersion@0

- script: |
env
apt install -y postgresql-client
psql --host=postgres --username=postgres --command="SELECT 1;"
python --version
python -m pip install --upgrade pip
pip install tox pipenv
displayName: 'Install dependencies'

- script: |
tox --version
tox
displayName: 'Run tests'

#- task: PublishTestResults@2
# inputs:
# testResultsFiles: 'tests/report.xml'
# testRunTitle: '$(Agent.OS) - $(Build.DefinitionName) - Python $(python.version)'
# condition: succeededOrFailed()

#- task: Docker@2
# displayName: Build an image
# inputs:
# repository: $(imageName)
# command: build
# Dockerfile: docker/Dockerfile
# buildContext: .

#- task: Docker@2
# displayName: Push image
# inputs:
# containerRegistry: |
# $(dockerHub)
# repository: $(imageName)
# command: push
# tags: |
# $(Build.BuildId)
# latest
23 changes: 23 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[pytest]
norecursedirs = data .tox
python_paths = ./tests/_test_lib ./src/
DJANGO_SETTINGS_MODULE = donor_reporting_portal.config.settings
django_find_project = false
addopts =
-v
--reuse-db
--tb=short
--maxfail=20
--echo-version=donor_reporting_portal
--echo-version=django
--echo-env=CIRCLECI
--echo-env=PIPENV_VERBOSITY
--capture=no
--cov-report=html
--cov-config=tests/.coveragerc
--cov=donor_reporting_portal

markers =
slow: marks tests as slow (deselect with '-m "not slow"')

pep8ignore = * ALL
3 changes: 2 additions & 1 deletion src/donor_reporting_portal/api/views/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def get(self, request):
'site_tracker': settings.MATOMO_SITE_TRACKER,
'site_id': settings.MATOMO_SITE_ID
},
'source_id': settings.DRP_SOURCE_IDS
'source_id': settings.DRP_SOURCE_IDS,
'gavi_donor_code': settings.GAVI_DONOR_CODE
},
status=status.HTTP_200_OK
)
2 changes: 1 addition & 1 deletion src/donor_reporting_portal/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
]

SECRET_KEY = env('SECRET_KEY')
SECRET_KEY = env('SECRET_KEY', default='change-me')
ALLOWED_HOSTS = (
env('ALLOWED_HOST', default='localhost'),
'0.0.0.0',
Expand Down