Skip to content

Commit

Permalink
test: using env vars in tests instead of hardcoding
Browse files Browse the repository at this point in the history
  • Loading branch information
witash committed Jul 4, 2024
1 parent 4f259ff commit 59a75a3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions tests/sqltest/contact.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SELECT
FROM v1.couchdb couchdb
LEFT JOIN v1.contact contact ON couchdb._id = contact.uuid
FROM {{ env_var('POSTGRES_SCHEMA') }}.{{ env_var('POSTGRES_TABLE') }} couchdb
LEFT JOIN {{ ref('contact') }} contact ON couchdb._id = contact.uuid
WHERE
couchdb.doc->>'type' IN ('contact', 'clinic', 'district_hospital', 'health_center', 'person')
-- TEST CONDITIONS
Expand Down
4 changes: 2 additions & 2 deletions tests/sqltest/data_record.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SELECT
FROM v1.couchdb couchdb
LEFT JOIN v1.data_record data_record ON couchdb._id = data_record.uuid
FROM {{ env_var('POSTGRES_SCHEMA') }}.{{ env_var('POSTGRES_TABLE') }} couchdb
LEFT JOIN {{ ref('data_record') }} data_record ON couchdb._id = data_record.uuid
WHERE
couchdb.doc->>'type' = 'data_record'
-- TEST CONDITIONS
Expand Down
3 changes: 1 addition & 2 deletions tests/sqltest/patient.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
SELECT
FROM v1.couchdb couchdb
LEFT JOIN v1.patient patient ON couchdb._id = patient.uuid
LEFT JOIN v1.contact contact ON couchdb._id = contact.uuid
LEFT JOIN {{ ref('patient') }} patient ON couchdb._id = patient.uuid
WHERE
(
(couchdb.doc->>'type' = 'person') OR
Expand Down
6 changes: 3 additions & 3 deletions tests/sqltest/person.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SELECT
FROM v1.couchdb couchdb
LEFT JOIN v1.person person ON couchdb._id = person.uuid
LEFT JOIN v1.contact contact ON contact.uuid = person.uuid
FROM {{ env_var('POSTGRES_SCHEMA') }}.{{ env_var('POSTGRES_TABLE') }} couchdb
LEFT JOIN {{ ref('person') }} person ON couchdb._id = person.uuid
LEFT JOIN {{ ref('contact') }} contact ON contact.uuid = person.uuid
WHERE
-- person conditions
(
Expand Down
6 changes: 3 additions & 3 deletions tests/sqltest/place.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SELECT
FROM v1.couchdb couchdb
LEFT JOIN v1.place place ON couchdb._id = place.uuid
LEFT JOIN v1.contact contact ON contact.uuid = place.uuid
FROM {{ env_var('POSTGRES_SCHEMA') }}.{{ env_var('POSTGRES_TABLE') }} couchdb
LEFT JOIN {{ ref('place') }} place ON couchdb._id = place.uuid
LEFT JOIN {{ ref('contact') }} contact ON contact.uuid = place.uuid
WHERE
-- person conditions
(
Expand Down

0 comments on commit 59a75a3

Please sign in to comment.