-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New View Tests #62
Merged
Merged
New View Tests #62
Changes from 10 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
5759a87
added view tests files
232930f
removed print statement, modified nhif files
2681a05
modification
c180e09
changed doctor and clinical officers
19a7e00
added health facilitites
08e4297
added nhif inpatient
43da631
added nhif outpatient
845c9ae
added nhif outpatient cs
b462139
added nurses
57313f3
modified test files
dc861fb
removed sys path lines
47f04bf
removed unnecessary lines from manage.py
c9b6469
pulled upstream develop
05f28ca
added .idea/
68beb65
removed .idea folder
d8fd812
removed test.zip
5f74297
updated readme.md with nosetest commands
6bd30f5
spacing nosetests commands
6cc2216
Merge branch 'develop' into tests
DavidLemayian ab9d6dc
Update README.md
DavidLemayian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import os | ||
import inspect | ||
import sys | ||
currentdir = os.path.dirname(os.path.abspath( | ||
inspect.getfile(inspect.currentframe()))) | ||
parentdir = os.path.dirname(currentdir) | ||
sys.path.insert(0, parentdir) | ||
import unittest | ||
from healthtools.manage import app | ||
|
||
class TestSetup(unittest.TestCase): | ||
def setUp(self): | ||
self.client = app.test_client() | ||
|
||
class TestClinicalOfficersAPIWithDoctype(TestSetup): | ||
""" | ||
This tests clinical officers search api with doctype | ||
""" | ||
|
||
def test_cos_endpoint_without_query(self): | ||
""" | ||
This tests running cos endpoint with valid doctype and no query | ||
""" | ||
response = self.client.get("search/clinical-officers?q=") | ||
self.assertIn(b"ELIKANAH KEBAGENDI OMWENGA", response.data) | ||
|
||
|
||
def test_cos_endpoint_gets_clinical_officers(self): | ||
""" | ||
This tests running cos endpoint with valid doctype and query | ||
""" | ||
response = self.client.get("search/clinical-officers?q=DABASO GARAMBODA") | ||
self.assertIn(b"OK", response.data) | ||
|
||
def test_cos_endpoint_with_bad_endpoint(self): | ||
""" | ||
This tests running an endpoint with incorrect/unavailable doctype | ||
""" | ||
response = self.client.get("search/clinicalofficers?q=DABASO GARAMBODA") | ||
self.assertIn(b'"status": "FAILED"', response.data) | ||
|
||
|
||
class TestClinicalOfficersAPIWithoutDoctype(TestSetup): | ||
""" | ||
This tests clinical officers search api without doctype, keywords are used instead | ||
""" | ||
def test_cos_endpoint_without_keyword_in_query(self): | ||
response = self.client.get("search?q=john") | ||
self.assertIn(b'"status": "FAILED"', response.data) | ||
|
||
def test_cos_endpoint_gets_clinical_officers(self): | ||
response = self.client.get("search?q=clinical oficer DABASO GARAMBODA") | ||
self.assertIn(b"OK", response.data) | ||
|
||
def test_cos_endpoint_with_keyword_only(self): | ||
""" | ||
This tests running cos endpoint with correct available keyword only | ||
""" | ||
response = self.client.get("search?q=CO") | ||
self.assertIn(b'"status": "FAILED"', response.data) | ||
|
||
|
||
def test_cos_endpoint_without_query(self): | ||
""" | ||
This tests running cos endpoint without query | ||
""" | ||
response = self.client.get("search?q=") | ||
self.assertIn(b'"status": "FAILED"', response.data) | ||
|
||
|
||
def test_cos_endpoint_with_nonkeyword(self): | ||
""" | ||
This tests running cos endpoint with a keyword that is unavailable. | ||
""" | ||
response = self.client.get("search?q=maji john") | ||
self.assertIn(b'"status": "FAILED"', response.data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import os | ||
import inspect | ||
import sys | ||
currentdir = os.path.dirname(os.path.abspath( | ||
inspect.getfile(inspect.currentframe()))) | ||
parentdir = os.path.dirname(currentdir) | ||
sys.path.insert(0, parentdir) | ||
import unittest | ||
from healthtools.manage import app | ||
|
||
class TestSetup(unittest.TestCase): | ||
def setUp(self): | ||
self.client = app.test_client() | ||
|
||
class TestDoctorsAPIWithDoctype(TestSetup): | ||
""" | ||
This tests doctors search api with doctype | ||
""" | ||
|
||
def test_doctors_endpoint_without_query(self): | ||
""" | ||
This tests running doctors endpoint with valid doctype and no query | ||
""" | ||
response = self.client.get("search/doctors?q=") | ||
self.assertIn(b"DR NARAYAN VIJAYA KUMAR", response.data) | ||
|
||
|
||
def test_doctors_endpoint_gets_doctors(self): | ||
""" | ||
This tests running doctors endpoint with valid doctype and query | ||
""" | ||
response = self.client.get("search/doctors?q=john") | ||
self.assertIn(b"OK", response.data) | ||
|
||
def test_doctors_endpoint_with_bad_endpoint(self): | ||
""" | ||
This tests running an endpoint with incorrect/unavailable doctype | ||
""" | ||
response = self.client.get("search/doctor?q=john") | ||
self.assertIn(b'"status": "FAILED"', response.data) | ||
|
||
class TestDoctorsAPIWithoutDoctype(TestSetup): | ||
""" | ||
This tests doctors search api without doctype, keywords are used instead | ||
""" | ||
def test_doctors_endpoint_without_keyword_in_query(self): | ||
response = self.client.get("search?q=john") | ||
self.assertIn(b'"status": "FAILED"', response.data) | ||
|
||
def test_doctors_endpoint_gets_doctors(self): | ||
response = self.client.get("search?q=daktari John") | ||
self.assertIn(b"OK", response.data) | ||
|
||
def test_doctors_endpoint_with_keyword_only(self): | ||
""" | ||
This tests running doctors endpoint with correct available keyword only | ||
""" | ||
response = self.client.get("search?q=daktari") | ||
self.assertIn(b'"status": "FAILED"', response.data) | ||
|
||
|
||
def test_doctors_endpoint_without_query(self): | ||
""" | ||
This tests running doctors endpoint without query | ||
""" | ||
response = self.client.get("search?q=") | ||
self.assertIn(b'"status": "FAILED"', response.data) | ||
|
||
|
||
def test_doctors_endpoint_with_nonkeyword(self): | ||
""" | ||
This tests running doctors endpoint with a keyword that is unavailable. | ||
""" | ||
response = self.client.get("search?q=maji john") | ||
self.assertIn(b'"status": "FAILED"', response.data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import os | ||
import inspect | ||
import sys | ||
|
||
currentdir = os.path.dirname(os.path.abspath( | ||
inspect.getfile(inspect.currentframe()))) | ||
parentdir = os.path.dirname(currentdir) | ||
sys.path.insert(0, parentdir) | ||
import unittest | ||
from healthtools.manage import app | ||
|
||
|
||
class TestSetup(unittest.TestCase): | ||
def setUp(self): | ||
self.client = app.test_client() | ||
|
||
|
||
class TestHealthFacilitiesAPIWithDoctype(TestSetup): | ||
""" | ||
This tests health-facilities search api with doctype | ||
""" | ||
|
||
def test_health_facilities_endpoint_without_query(self): | ||
""" | ||
This tests running health-facilities endpoint with valid doctype and no query | ||
""" | ||
response = self.client.get("search/health-facilities?q=") | ||
self.assertIn(b"Tamba Pwani", response.data) | ||
|
||
def test_health_facilities_endpoint_gets_health_facilities(self): | ||
""" | ||
This tests running health-facilities endpoint with valid doctype and query | ||
""" | ||
response = self.client.get("search/health-facilities?q=eldoret") | ||
self.assertIn(b"OK", response.data) | ||
|
||
def test_health_facilities_endpoint_with_bad_endpoint(self): | ||
""" | ||
This tests running an endpoint with incorrect/unavailable doctype | ||
""" | ||
response = self.client.get("search/healthfacilities?q=Kitale") | ||
self.assertIn(b'"status": "FAILED"', response.data) | ||
|
||
|
||
class TestHealthFacilitiesAPIWithoutDoctype(TestSetup): | ||
""" | ||
This tests health-facilities search api without doctype, keywords are used instead | ||
""" | ||
|
||
def test_health_facilities_endpoint_without_keyword_in_query(self): | ||
response = self.client.get("search?q=kakamega") | ||
self.assertIn(b'"status": "FAILED"', response.data) | ||
|
||
def test_health_facilities_endpoint_gets_health_facilities(self): | ||
response = self.client.get("search?q=dispensary Kilifi") | ||
self.assertIn(b"OK", response.data) | ||
|
||
def test_health_facilities_endpoint_with_keyword_only(self): | ||
""" | ||
This tests running health-facilities endpoint with correct available keyword only | ||
""" | ||
response = self.client.get("search?q=hf") | ||
self.assertIn(b'"status": "FAILED"', response.data) | ||
|
||
def test_health_facilities_endpoint_without_query(self): | ||
""" | ||
This tests running health-facilities endpoint without query | ||
""" | ||
response = self.client.get("search?q=") | ||
self.assertIn(b'"status": "FAILED"', response.data) | ||
|
||
def test_health_facilities_endpoint_with_nonkeyword(self): | ||
""" | ||
This tests running health-facilities endpoint with a keyword that is unavailable. | ||
""" | ||
response = self.client.get("search?q=maji Mombasa") | ||
self.assertIn(b'"status": "FAILED"', response.data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import os | ||
import inspect | ||
import sys | ||
|
||
currentdir = os.path.dirname(os.path.abspath( | ||
inspect.getfile(inspect.currentframe()))) | ||
parentdir = os.path.dirname(currentdir) | ||
sys.path.insert(0, parentdir) | ||
import unittest | ||
from healthtools.manage import app | ||
|
||
|
||
class TestSetup(unittest.TestCase): | ||
def setUp(self): | ||
self.client = app.test_client() | ||
|
||
|
||
class TestNhifInpatientAPIWithDoctype(TestSetup): | ||
""" | ||
This tests nhif-inpatient search api with doctype | ||
""" | ||
|
||
def test_nhif_inpatient_endpoint_without_query(self): | ||
""" | ||
This tests running nhif-inpatient endpoint with valid doctype and no query | ||
""" | ||
response = self.client.get("search/nhif-inpatient?q=") | ||
self.assertIn(b"MARIE STOPES KENYA LIMITED", response.data) | ||
|
||
def test_nhif_inpatient_endpoint_gets_nhif_inpatient(self): | ||
""" | ||
This tests running nhif-inpatient endpoint with valid doctype and query | ||
""" | ||
response = self.client.get("search/nhif-inpatient?q=MATHARE") | ||
self.assertIn(b"OK", response.data) | ||
|
||
def test_nhif_inpatient_endpoint_with_bad_endpoint(self): | ||
""" | ||
This tests running an endpoint with incorrect/unavailable doctype | ||
""" | ||
response = self.client.get("search/nhifinpatient?q=MATHARE") | ||
self.assertIn(b'"status": "FAILED"', response.data) | ||
|
||
|
||
class TestNhifInpatientAPIWithoutDoctype(TestSetup): | ||
""" | ||
This tests nhif-inpatient search api without doctype, keywords are used instead | ||
""" | ||
|
||
def test_nhif_inpatient_endpoint_without_keyword_in_query(self): | ||
response = self.client.get("search?q=Kilifi") | ||
self.assertIn(b'"status": "FAILED"', response.data) | ||
|
||
def test_nhif_inpatient_endpoint_gets_nhif_inpatient(self): | ||
response = self.client.get("search?q=bima inpatient Kilifi") | ||
self.assertIn(b"OK", response.data) | ||
|
||
def test_nhif_inpatient_endpoint_with_keyword_only(self): | ||
""" | ||
This tests running nhif-inpatient endpoint with correct available keyword only | ||
""" | ||
response = self.client.get("search?q=inpatient insurance") | ||
self.assertIn(b'"status": "FAILED"', response.data) | ||
|
||
def test_nhif_inpatient_endpoint_without_query(self): | ||
""" | ||
This tests running nhif-inpatient endpoint without query | ||
""" | ||
response = self.client.get("search?q=") | ||
self.assertIn(b'"status": "FAILED"', response.data) | ||
|
||
def test_nhif_inpatient_endpoint_with_nonkeyword(self): | ||
""" | ||
This tests running nhif-inpatient endpoint with a keyword that is unavailable. | ||
""" | ||
response = self.client.get("search?q=maji Kilifi") | ||
self.assertIn(b'"status": "FAILED"', response.data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import os | ||
import inspect | ||
import sys | ||
|
||
currentdir = os.path.dirname(os.path.abspath( | ||
inspect.getfile(inspect.currentframe()))) | ||
parentdir = os.path.dirname(currentdir) | ||
sys.path.insert(0, parentdir) | ||
import unittest | ||
from healthtools.manage import app | ||
|
||
|
||
class TestSetup(unittest.TestCase): | ||
def setUp(self): | ||
self.client = app.test_client() | ||
|
||
|
||
class TestNhifOutpatientAPIWithDoctype(TestSetup): | ||
""" | ||
This tests nhif-outpatient search api with doctype | ||
""" | ||
|
||
def test_nhif_outpatient_endpoint_without_query(self): | ||
""" | ||
This tests running nhif-outpatient endpoint with valid doctype and no query | ||
""" | ||
response = self.client.get("search/nhif-outpatient?q=") | ||
self.assertIn(b"AMIN WOMEN'S CARE CLINIC", response.data) | ||
|
||
def test_nhif_outpatient_endpoint_gets_nhif_outpatient(self): | ||
""" | ||
This tests running nhif-outpatient endpoint with valid doctype and query | ||
""" | ||
response = self.client.get("search/nhif-outpatient?q=BRISTOL") | ||
self.assertIn(b"OK", response.data) | ||
|
||
def test_nhif_outpatient_endpoint_with_bad_endpoint(self): | ||
""" | ||
This tests running an endpoint with incorrect/unavailable doctype | ||
""" | ||
response = self.client.get("search/nhifoutpatient?q=BRISTOL") | ||
self.assertIn(b'"status": "FAILED"', response.data) | ||
|
||
|
||
class TestNhifOutpatientAPIWithoutDoctype(TestSetup): | ||
""" | ||
This tests nhif-outpatient search api without doctype, keywords are used instead | ||
""" | ||
|
||
def test_nhif_outpatient_endpoint_without_keyword_in_query(self): | ||
response = self.client.get("search?q=Kenyatta") | ||
self.assertIn(b'"status": "FAILED"', response.data) | ||
|
||
def test_nhif_outpatient_endpoint_gets_nhif_outpatient(self): | ||
response = self.client.get("search?q=bima outpatient Kilifi") | ||
self.assertIn(b"OK", response.data) | ||
|
||
def test_nhif_outpatient_endpoint_with_keyword_only(self): | ||
""" | ||
This tests running nhif-outpatient endpoint with correct available keyword only | ||
""" | ||
response = self.client.get("search?q=outpatient insurance") | ||
self.assertIn(b'"status": "FAILED"', response.data) | ||
|
||
def test_nhif_outpatient_endpoint_without_query(self): | ||
""" | ||
This tests running nhif-outpatient endpoint without query | ||
""" | ||
response = self.client.get("search?q=") | ||
self.assertIn(b'"status": "FAILED"', response.data) | ||
|
||
def test_nhif_outpatient_endpoint_with_nonkeyword(self): | ||
""" | ||
This tests running nhif-outpatient endpoint with a keyword that is unavailable. | ||
""" | ||
response = self.client.get("search?q=maji Kilifi") | ||
self.assertIn(b'"status": "FAILED"', response.data) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are these four lines of code for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Awinja-Andela ☝️