-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved the Guidewell API URLs to payer-patient-access.csv and created …
…a unit test file for GuidewellURLWebscraper
- Loading branch information
1 parent
ddf774c
commit f58e34d
Showing
6 changed files
with
119 additions
and
29 deletions.
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
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
82 changes: 82 additions & 0 deletions
82
endpointmanager/pkg/chplendpointquerier/guidewellurlwebscraper_test.go
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,82 @@ | ||
package chplendpointquerier | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
th "github.com/onc-healthit/lantern-back-end/endpointmanager/pkg/testhelper" | ||
) | ||
|
||
func Test_GuidewellURLWebscraper(t *testing.T) { | ||
|
||
// Patient Access API Test Cases | ||
// 1. Happy case: Valid url, valid file format | ||
GuidewellURLWebscraper("https://developer.bcbsfl.com/interop/interop-developer-portal/product/306/api/285#/CMSInteroperabilityPatientAccessMetadata_100/operation/%2FR4%2Fmetadata/get", "TEST_Medicare_GuidewellPatientAccessEndpointSources.json") | ||
|
||
fileExists, err := doesfileExist("TEST_Medicare_GuidewellPatientAccessEndpointSources.json") | ||
th.Assert(t, err == nil, err) | ||
th.Assert(t, fileExists, "JSON file does not exist") | ||
|
||
fileEmpty, err := isFileEmpty("TEST_Medicare_GuidewellPatientAccessEndpointSources.json") | ||
th.Assert(t, err == nil, err) | ||
th.Assert(t, !fileEmpty, "Empty JSON file") | ||
|
||
err = os.Remove("../../../resources/prod_resources/TEST_Medicare_GuidewellPatientAccessEndpointSources.json") | ||
th.Assert(t, err == nil, err) | ||
|
||
err = os.Remove("../../../resources/dev_resources/TEST_Medicare_GuidewellPatientAccessEndpointSources.json") | ||
th.Assert(t, err == nil, err) | ||
|
||
// 2. Different file format | ||
GuidewellURLWebscraper("https://developer.bcbsfl.com/interop/interop-developer-portal/product/306/api/285#/CMSInteroperabilityPatientAccessMetadata_100/operation/%2FR4%2Fmetadata/get", "TEST_Medicare_GuidewellPatientAccessEndpointSources.csv") | ||
|
||
fileExists, err = doesfileExist("TEST_Medicare_GuidewellPatientAccessEndpointSources.csv") | ||
th.Assert(t, err == nil, err) | ||
th.Assert(t, fileExists, "CSV file does not exist") | ||
|
||
fileEmpty, err = isFileEmpty("TEST_Medicare_GuidewellPatientAccessEndpointSources.csv") | ||
th.Assert(t, err == nil, err) | ||
th.Assert(t, !fileEmpty, "Empty CSV file") | ||
|
||
err = os.Remove("../../../resources/prod_resources/TEST_Medicare_GuidewellPatientAccessEndpointSources.csv") | ||
th.Assert(t, err == nil, err) | ||
|
||
err = os.Remove("../../../resources/dev_resources/TEST_Medicare_GuidewellPatientAccessEndpointSources.csv") | ||
th.Assert(t, err == nil, err) | ||
|
||
// Payer2Payer API Test Cases | ||
// 1. Happy case: Valid url, valid file format | ||
GuidewellURLWebscraper("https://developer.bcbsfl.com/interop/interop-developer-portal/product/309/api/288#/CMSInteroperabilityPayer2PayerOutboundMetadata_100/operation/%2FP2P%2FR4%2Fmetadata/get", "TEST_Medicare_GuidewellPayer2PayerEndpointSources.json") | ||
|
||
fileExists, err = doesfileExist("TEST_Medicare_GuidewellPayer2PayerEndpointSources.json") | ||
th.Assert(t, err == nil, err) | ||
th.Assert(t, fileExists, "JSON file does not exist") | ||
|
||
fileEmpty, err = isFileEmpty("TEST_Medicare_GuidewellPayer2PayerEndpointSources.json") | ||
th.Assert(t, err == nil, err) | ||
th.Assert(t, !fileEmpty, "Empty JSON file") | ||
|
||
err = os.Remove("../../../resources/prod_resources/TEST_Medicare_GuidewellPayer2PayerEndpointSources.json") | ||
th.Assert(t, err == nil, err) | ||
|
||
err = os.Remove("../../../resources/dev_resources/TEST_Medicare_GuidewellPayer2PayerEndpointSources.json") | ||
th.Assert(t, err == nil, err) | ||
|
||
// 2. Different file format | ||
GuidewellURLWebscraper("https://developer.bcbsfl.com/interop/interop-developer-portal/product/309/api/288#/CMSInteroperabilityPayer2PayerOutboundMetadata_100/operation/%2FP2P%2FR4%2Fmetadata/get", "TEST_Medicare_GuidewellPayer2PayerEndpointSources.csv") | ||
|
||
fileExists, err = doesfileExist("TEST_Medicare_GuidewellPayer2PayerEndpointSources.csv") | ||
th.Assert(t, err == nil, err) | ||
th.Assert(t, fileExists, "CSV file does not exist") | ||
|
||
fileEmpty, err = isFileEmpty("TEST_Medicare_GuidewellPayer2PayerEndpointSources.csv") | ||
th.Assert(t, err == nil, err) | ||
th.Assert(t, !fileEmpty, "Empty CSV file") | ||
|
||
err = os.Remove("../../../resources/prod_resources/TEST_Medicare_GuidewellPayer2PayerEndpointSources.csv") | ||
th.Assert(t, err == nil, err) | ||
|
||
err = os.Remove("../../../resources/dev_resources/TEST_Medicare_GuidewellPayer2PayerEndpointSources.csv") | ||
th.Assert(t, err == nil, err) | ||
|
||
} |
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
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
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