Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Commit

Permalink
abstract demo server versions
Browse files Browse the repository at this point in the history
  • Loading branch information
taylordowns2000 committed Mar 22, 2021
1 parent 1c6400e commit 7ee8a86
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 33 deletions.
61 changes: 32 additions & 29 deletions test/ClientFixtures.js
@@ -1,3 +1,6 @@
const demoVersion = '2.35';
const apiVersion = '35';

const fixtures = {
event: {
requestBody: {
Expand Down Expand Up @@ -55,8 +58,8 @@ export const upsertNewState = {
configuration: {
username: 'admin',
password: 'district',
hostUrl: 'https://play.dhis2.org/2.35.1',
apiVersion: 35,
hostUrl: `https://play.dhis2.org/${demoVersion}`,
apiVersion,
},
data: {
orgUnit: 'TSyzvBiovKh',
Expand Down Expand Up @@ -90,8 +93,8 @@ export const upsertExistingState = {
configuration: {
username: 'admin',
password: 'district',
hostUrl: 'https://play.dhis2.org/2.35.1',
apiVersion: 35,
hostUrl: `https://play.dhis2.org/${demoVersion}`,
apiVersion,
},
data: {
orgUnit: 'TSyzvBiovKh',
Expand Down Expand Up @@ -125,8 +128,8 @@ export const upsertNewTEIState = {
configuration: {
username: 'admin',
password: 'district',
hostUrl: 'https://play.dhis2.org/2.35.1',
apiVersion: 35,
hostUrl: `https://play.dhis2.org/${demoVersion}`,
apiVersion,
},
data: {
orgUnit: 'TSyzvBiovKh',
Expand Down Expand Up @@ -160,8 +163,8 @@ export const upsertExistingTEIState = {
configuration: {
username: 'admin',
password: 'district',
hostUrl: 'https://play.dhis2.org/2.35.1',
apiVersion: 35,
hostUrl: `https://play.dhis2.org/${demoVersion}`,
apiVersion,
},
data: {
orgUnit: 'TSyzvBiovKh',
Expand Down Expand Up @@ -206,8 +209,8 @@ export const createEventsState = {
configuration: {
username: 'admin',
password: 'district',
hostUrl: 'https://play.dhis2.org/2.35.1',
apiVersion: 35,
hostUrl: `https://play.dhis2.org/${demoVersion}`,
apiVersion,
},
data: {
program: 'eBAyeGv0exc',
Expand Down Expand Up @@ -241,8 +244,8 @@ export const sendDataForMultipleEventsState = {
configuration: {
username: 'admin',
password: 'district',
hostUrl: 'https://play.dhis2.org/2.35.1',
apiVersion: 35,
hostUrl: `https://play.dhis2.org/${demoVersion}`,
apiVersion,
},
data: {
events: [
Expand Down Expand Up @@ -296,8 +299,8 @@ export const createState = {
configuration: {
username: 'admin',
password: 'district',
hostUrl: 'https://play.dhis2.org/2.35.1',
apiVersion: 35,
hostUrl: `https://play.dhis2.org/${demoVersion}`,
apiVersion,
},
data: {
program: 'eBAyeGv0exc',
Expand Down Expand Up @@ -331,8 +334,8 @@ export const createBulkUnrelatedDataValues = {
configuration: {
username: 'admin',
password: 'district',
hostUrl: 'https://play.dhis2.org/2.35.1',
apiVersion: 35,
hostUrl: `https://play.dhis2.org/${demoVersion}`,
apiVersion,
},
data: {
dataValues: [
Expand Down Expand Up @@ -368,8 +371,8 @@ export const createRelatedDataValues = {
configuration: {
username: 'admin',
password: 'district',
hostUrl: 'https://play.dhis2.org/2.35.1',
apiVersion: 35,
hostUrl: `https://play.dhis2.org/${demoVersion}`,
apiVersion,
},
data: {
dataSet: 'pBOMPrpg1QX',
Expand Down Expand Up @@ -397,8 +400,8 @@ export const updateState = {
configuration: {
username: 'admin',
password: 'district',
hostUrl: 'https://play.dhis2.org/2.35.1',
apiVersion: 35,
hostUrl: `https://play.dhis2.org/${demoVersion}`,
apiVersion,
},
data: {
id: 'FTRrcoaog83',
Expand All @@ -414,8 +417,8 @@ export const patchState = {
configuration: {
username: 'admin',
password: 'district',
hostUrl: 'https://play.dhis2.org/2.35.1',
apiVersion: 35,
hostUrl: `https://play.dhis2.org/${demoVersion}`,
apiVersion,
},
data: {
name: 'Patched Name ' + Date.now(),
Expand All @@ -426,8 +429,8 @@ export const delState = {
configuration: {
username: 'admin',
password: 'district',
hostUrl: 'https://play.dhis2.org/2.35.1',
apiVersion: 35,
hostUrl: `https://play.dhis2.org/${demoVersion}`,
apiVersion,
},
data: {
orgUnit: 'TSyzvBiovKh',
Expand Down Expand Up @@ -462,17 +465,17 @@ export const getState = {
configuration: {
username: 'admin',
password: 'district',
hostUrl: 'https://play.dhis2.org/2.35.1',
apiVersion: 35,
hostUrl: `https://play.dhis2.org/${demoVersion}`,
apiVersion,
},
};

export const enrollTEIState = {
configuration: {
username: 'admin',
password: 'district',
hostUrl: 'https://play.dhis2.org/2.35.1',
apiVersion: 35,
hostUrl: `https://play.dhis2.org/${demoVersion}`,
apiVersion,
},
data: {
orgUnit: 'TSyzvBiovKh',
Expand All @@ -494,7 +497,7 @@ export const enrollTEIState = {
},
};

export { fixtures };
export { fixtures, demoVersion };

export default [
{
Expand Down
10 changes: 6 additions & 4 deletions test/index.js
Expand Up @@ -36,6 +36,7 @@ import {
createEventsState,
sendDataForMultipleEventsState,
enrollTEIState,
demoVersion,
} from './ClientFixtures';
import { permissions, userRoles, personAttributes } from './SetupFixtures';
import { result } from 'lodash';
Expand Down Expand Up @@ -91,14 +92,15 @@ describe('execute', () => {
});

describe('live adaptor testing', () => {
console.log(demoVersion);
// before ALL tests run, we must re-configure the dhis2 environment
before(function () {
this.timeout(30000);
let state = {
configuration: {
username: 'admin',
password: 'district',
hostUrl: 'https://play.dhis2.org/2.35.0',
hostUrl: `https://play.dhis2.org/${demoVersion}`,
},
};

Expand Down Expand Up @@ -145,7 +147,7 @@ describe('live adaptor testing', () => {
configuration: {
username: 'admin',
password: 'district',
hostUrl: 'https://play.dhis2.org/2.35.0',
hostUrl: `https://play.dhis2.org/${demoVersion}`,
apiVersion: 34,
},
};
Expand All @@ -162,7 +164,7 @@ describe('live adaptor testing', () => {
configuration: {
username: 'admin',
password: 'district',
hostUrl: 'https://play.dhis2.org/2.35.0',
hostUrl: `https://play.dhis2.org/${demoVersion}`,
},
};

Expand All @@ -185,7 +187,7 @@ describe('live adaptor testing', () => {
configuration: {
username: 'admin',
password: 'district',
hostUrl: 'https://play.dhis2.org/2.35.0',
hostUrl: `https://play.dhis2.org/${demoVersion}`,
},
};

Expand Down

0 comments on commit 7ee8a86

Please sign in to comment.