Skip to content

Commit

Permalink
Merge pull request #191 from pepfar-datim/hide-submit
Browse files Browse the repository at this point in the history
cleaning up
  • Loading branch information
jakub-bao authored Apr 17, 2020
2 parents 82b9446 + 94d5d1a commit 893318e
Show file tree
Hide file tree
Showing 26 changed files with 111 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ cypress/scripts/mechanism/api.pyc
cypress/scripts/users/api.pyc
cypress/scripts/dataStore/__pycache__/
cypress/scripts/dataStore/api.pyc

*.pyc
3 changes: 0 additions & 3 deletions cypress/scripts/install.sh

This file was deleted.

2 changes: 1 addition & 1 deletion public/manifest.webapp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"default_locale": "en",
"appType": "APP",
"name": "Data Approval",
"version": "2.0.2",
"version": "2.0.5",
"description": "DATIM Mechanisms Approval App",
"developer": {
"name": "Jakub Flaska",
Expand Down
2 changes: 1 addition & 1 deletion src/config/serverConfig.dev.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"baseUrl": "https://test.datim.org/",
"baseUrl": "https://sandbox.er.datim.org/",
"sqlViewId": "rQZnEgCAhuI",
"apiVersion": "30"
}
1 change: 1 addition & 0 deletions src/config/workflows.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[
{"name": "ER Expenditures FYOct", "id": "WUD8TApgOu1", "type": "ER"},
{"name": "Workplan Budgets FYOct", "id": "e8F8M6leZjj", "type": "ER"},
{"name": "MER Results", "id": "RwNpkAM7Hw7", "type": "MER"},
{"name": "MER Targets", "id": "TAjCBkG6hl6", "type": "MER"}
]
2 changes: 2 additions & 0 deletions testData/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions testData/.idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions testData/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions testData/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions testData/.idea/scripts.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions testData/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
44 changes: 44 additions & 0 deletions testData/cors/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import requests
import os

api = os.environ['DHIS_BASEURL'] + '/api/'
credentials = (os.environ['DHIS_USERNAME'], os.environ['DHIS_PASSWORD'])

res = requests.get(api + 'resources.json', auth=credentials)
if res.json()['resources'][0]:
print('Connected to DHIS2: ' + api)
else:
raise Exception("Cannot connect to DHIS2: " + api)

def get(url, params):
res = requests.get(api + url, auth=credentials, params=params)
process_status_code(res, 'get')
return res.json()

def delete(url):
res = requests.delete(api + url, auth=credentials)
process_status_code(res, 'delete')


def post(url, body):
res = requests.post(api + url, auth=credentials, json=body)
process_status_code(res, 'post')

def formPost(url, data):
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
res = requests.post(api + url, auth=credentials, data=data, headers=headers)
process_status_code(res, 'post')

def put(url, body):
res = requests.put(api + url, auth=credentials, json=body)
process_status_code(res, 'put')

def process_status_code(response, method):
if response.status_code in range(200,210):
print(method + ' to url ' + response.url + ' successful')
else:
print(method + ' to url ' + response.url + ' failed')
try:
print(response.json())
except:
print(response)
5 changes: 5 additions & 0 deletions testData/cors/cors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/python

import api

api.post('configuration/corsWhitelist', ["http://localhost:3000","http://localhost:3001","http://localhost:3002","http://localhost:3003","http://localhost:3004","http://localhost:3005"])
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions cypress/scripts/dataStore/fixDataStore.py → testData/dataStore/dataStore.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/python

import api


Expand Down
18 changes: 18 additions & 0 deletions testData/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/bash

section(){
echo ----------------------------
echo $1
}

section Users \> Adding test user accounts
(cd users && ./persistUsers.py)

section DataStore \> Opening data entry periods for dedupes
(cd dataStore && ./dataStore.py)

section Mechanisms \> Submit mechanisms to expected level
(cd mechanisms && ./submitMechanisms.py)

section CORS \> Whitelist localhost
(cd cors && ./cors.py)
File renamed without changes.
2 changes: 2 additions & 0 deletions ...ess/scripts/mechanism/submitMechanisms.py → testData/mechanisms/submitMechanisms.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/python

import api


Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions cypress/scripts/users/persist_users.py → testData/users/persistUsers.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/python

import api
import json
import os
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 893318e

Please sign in to comment.