-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from sizets/generatre-vcr-recordings
generated Vcr recordings for disabled tests and added new tests
- Loading branch information
Showing
32 changed files
with
383,580 additions
and
41,659 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,4 @@ js/node_modules | |
js/local.log | ||
js/playwright-report | ||
js/test-results | ||
vendor |
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 |
---|---|---|
@@ -1,33 +1,45 @@ | ||
package internal | ||
|
||
// | ||
//func TestGetSourceClientAllscripts_SyncAll(t *testing.T) { | ||
//TODO: need to regenerate with _count | ||
//t.Skipf("skipping test, need to regenerate with _count") | ||
// t.Parallel() | ||
// //setup | ||
// testLogger := logrus.WithFields(logrus.Fields{ | ||
// "type": "test", | ||
// }) | ||
// mockCtrl := gomock.NewController(t) | ||
// defer mockCtrl.Finish() | ||
// fakeDatabase := mock_models.NewMockDatabaseRepository(mockCtrl) | ||
// fakeDatabase.EXPECT().UpsertRawResource(gomock.Any(), gomock.Any(), gomock.Any()).Times(158).Return(true, nil) | ||
// | ||
// fakeSourceCredential := mock_models.NewMockSourceCredential(mockCtrl) | ||
// fakeSourceCredential.EXPECT().GetPatientId().AnyTimes().Return("6709dc13-ca3e-4969-886a-fe0889eb8256") | ||
// fakeSourceCredential.EXPECT().GetSourceType().AnyTimes().Return(pkg.SourceTypeAllscripts) | ||
// fakeSourceCredential.EXPECT().GetApiEndpointBaseUrl().AnyTimes().Return("https://pro171fmh.open.allscripts.com/open") | ||
// | ||
// httpClient := base.OAuthVcrSetup(t, false) | ||
// client, _, err := GetSourceClientAllscripts(pkg.FastenLighthouseEnvSandbox, context.Background(), testLogger, fakeSourceCredential, httpClient) | ||
// | ||
// //test | ||
// resp, err := client.SyncAll(fakeDatabase) | ||
// require.NoError(t, err) | ||
// | ||
// //assert | ||
// require.NoError(t, err) | ||
// require.Equal(t, 158, resp.TotalResources) | ||
// require.Equal(t, 158, len(resp.UpdatedResources)) | ||
//} | ||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/fastenhealth/fasten-sources/clients/internal/base" | ||
"github.com/fastenhealth/fasten-sources/clients/models" | ||
mock_models "github.com/fastenhealth/fasten-sources/clients/models/mock" | ||
"github.com/fastenhealth/fasten-sources/pkg" | ||
"github.com/golang/mock/gomock" | ||
"github.com/sirupsen/logrus" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestGetSourceClientAllscripts_SyncAll(t *testing.T) { | ||
// TODO: need to regenerate with _count | ||
t.Skipf("skipping test, need to regenerate with _count") | ||
t.Parallel() | ||
//setup | ||
testLogger := logrus.WithFields(logrus.Fields{ | ||
"type": "test", | ||
}) | ||
mockCtrl := gomock.NewController(t) | ||
defer mockCtrl.Finish() | ||
fakeDatabase := mock_models.NewMockDatabaseRepository(mockCtrl) | ||
fakeDatabase.EXPECT().UpsertRawResource(gomock.Any(), gomock.Any(), gomock.Any()).Times(158).Return(true, nil) | ||
|
||
fakeSourceCredential := mock_models.NewMockSourceCredential(mockCtrl) | ||
fakeSourceCredential.EXPECT().GetPatientId().AnyTimes().Return("6709dc13-ca3e-4969-886a-fe0889eb8256") | ||
fakeSourceCredential.EXPECT().GetPlatformType().AnyTimes().Return(pkg.PlatformTypeAllscripts) | ||
fakeSourceCredential.EXPECT().GetEndpointId().AnyTimes().Return("7682675b-8247-4fda-b2cd-048bfeafc8af") | ||
|
||
httpClient := base.OAuthVcrSetup(t, false) | ||
client, err := GetDynamicSourceClient(pkg.FastenLighthouseEnvSandbox, context.Background(), testLogger, fakeSourceCredential, models.WithTestHttpClient(httpClient)) | ||
|
||
//test | ||
resp, err := client.SyncAll(fakeDatabase) | ||
require.NoError(t, err) | ||
|
||
//assert | ||
require.NoError(t, err) | ||
require.Equal(t, 158, resp.TotalResources) | ||
require.Equal(t, 158, len(resp.UpdatedResources)) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,46 @@ | ||
package internal | ||
|
||
// | ||
//import ( | ||
// "context" | ||
// "github.com/fastenhealth/fasten-sources/clients/internal/base" | ||
// "github.com/fastenhealth/fasten-sources/clients/models" | ||
// mock_models "github.com/fastenhealth/fasten-sources/clients/models/mock" | ||
// "github.com/fastenhealth/fasten-sources/pkg" | ||
// "github.com/golang/mock/gomock" | ||
// "github.com/sirupsen/logrus" | ||
// "github.com/stretchr/testify/require" | ||
// "testing" | ||
//) | ||
// | ||
//func TestGetSourceClientCerner_SyncAll(t *testing.T) { | ||
//TODO: need to regenerate with _count | ||
//t.Skipf("skipping test, need to regenerate with _count") | ||
// t.Parallel() | ||
// //setup | ||
// testLogger := logrus.WithFields(logrus.Fields{ | ||
// "type": "test", | ||
// }) | ||
// mockCtrl := gomock.NewController(t) | ||
// defer mockCtrl.Finish() | ||
// fakeDatabase := mock_models.NewMockDatabaseRepository(mockCtrl) | ||
// fakeDatabase.EXPECT().UpsertRawResource(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return(true, nil) | ||
// fakeDatabase.EXPECT().BackgroundJobCheckpoint(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return() | ||
// | ||
// fakeSourceCredential := mock_models.NewMockSourceCredential(mockCtrl) | ||
// fakeSourceCredential.EXPECT().GetPatientId().AnyTimes().Return("12724067") | ||
// fakeSourceCredential.EXPECT().GetPlatformType().AnyTimes().Return(pkg.PlatformTypeCerner) | ||
// fakeSourceCredential.EXPECT().GetEndpointId().AnyTimes().Return("3290e5d7-978e-42ad-b661-1cf8a01a989c") | ||
// | ||
// httpClient := base.OAuthVcrSetup( | ||
// t, | ||
// false, | ||
// ) | ||
// client, err := GetDynamicSourceClient(pkg.FastenLighthouseEnvSandbox, context.Background(), testLogger, fakeSourceCredential, models.WithTestHttpClient(httpClient)) | ||
// | ||
// //test | ||
// resp, err := client.SyncAll(fakeDatabase) | ||
// require.NoError(t, err) | ||
// | ||
// //assert | ||
// require.NoError(t, err) | ||
// require.Equal(t, 864, resp.TotalResources) | ||
// require.Equal(t, 853, len(resp.UpdatedResources)) | ||
//} | ||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/fastenhealth/fasten-sources/clients/internal/base" | ||
"github.com/fastenhealth/fasten-sources/clients/models" | ||
mock_models "github.com/fastenhealth/fasten-sources/clients/models/mock" | ||
"github.com/fastenhealth/fasten-sources/pkg" | ||
"github.com/golang/mock/gomock" | ||
"github.com/sirupsen/logrus" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestGetSourceClientCerner_SyncAll(t *testing.T) { | ||
// TODO: need to regenerate with _count | ||
// t.Skipf("skipping test, need to regenerate with _count") | ||
t.Parallel() | ||
//setup | ||
testLogger := logrus.WithFields(logrus.Fields{ | ||
"type": "test", | ||
}) | ||
mockCtrl := gomock.NewController(t) | ||
defer mockCtrl.Finish() | ||
fakeDatabase := mock_models.NewMockDatabaseRepository(mockCtrl) | ||
fakeDatabase.EXPECT().UpsertRawResource(gomock.Any(), gomock.Any(), gomock.Any()).Times(180).Return(true, nil) | ||
fakeDatabase.EXPECT().BackgroundJobCheckpoint(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return() | ||
|
||
fakeSourceCredential := mock_models.NewMockSourceCredential(mockCtrl) | ||
fakeSourceCredential.EXPECT().GetPatientId().AnyTimes().Return("12724066") | ||
fakeSourceCredential.EXPECT().GetPlatformType().AnyTimes().Return(pkg.PlatformTypeCerner) | ||
fakeSourceCredential.EXPECT().GetEndpointId().AnyTimes().Return("3290e5d7-978e-42ad-b661-1cf8a01a989c") | ||
|
||
httpClient := base.OAuthVcrSetup(t, false) | ||
client, err := GetDynamicSourceClient(pkg.FastenLighthouseEnvSandbox, context.Background(), testLogger, fakeSourceCredential, models.WithTestHttpClient(httpClient)) | ||
|
||
//test | ||
resp, err := client.SyncAll(fakeDatabase) | ||
require.NoError(t, err) | ||
|
||
//assert | ||
|
||
require.Equal(t, 864, resp.TotalResources) | ||
require.Equal(t, 853, len(resp.UpdatedResources)) | ||
} |
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,46 @@ | ||
package internal | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/fastenhealth/fasten-sources/clients/internal/base" | ||
"github.com/fastenhealth/fasten-sources/clients/models" | ||
mock_models "github.com/fastenhealth/fasten-sources/clients/models/mock" | ||
"github.com/fastenhealth/fasten-sources/pkg" | ||
"github.com/golang/mock/gomock" | ||
"github.com/sirupsen/logrus" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestGetSourceClientChBase_SyncAll(t *testing.T) { | ||
// TODO: need to regenerate with _count | ||
// t.Skipf("skipping test, need to regenerate with _count") | ||
t.Parallel() | ||
//setup | ||
testLogger := logrus.WithFields(logrus.Fields{ | ||
"type": "test", | ||
}) | ||
mockCtrl := gomock.NewController(t) | ||
defer mockCtrl.Finish() | ||
fakeDatabase := mock_models.NewMockDatabaseRepository(mockCtrl) | ||
fakeDatabase.EXPECT().UpsertRawResource(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return(true, nil) | ||
fakeDatabase.EXPECT().BackgroundJobCheckpoint(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return() | ||
|
||
fakeSourceCredential := mock_models.NewMockSourceCredential(mockCtrl) | ||
fakeSourceCredential.EXPECT().GetPatientId().AnyTimes().Return("47c1df49-98a3-470e-bc51-69c8773f4cbf") | ||
fakeSourceCredential.EXPECT().GetPlatformType().AnyTimes().Return(pkg.PlatformTypeCHBase) | ||
fakeSourceCredential.EXPECT().GetEndpointId().AnyTimes().Return("ee5e19b6-4539-4e46-baab-b892061fe448") | ||
|
||
httpClient := base.OAuthVcrSetup(t, false) | ||
client, err := GetDynamicSourceClient(pkg.FastenLighthouseEnvSandbox, context.Background(), testLogger, fakeSourceCredential, models.WithTestHttpClient(httpClient)) | ||
|
||
//test | ||
resp, err := client.SyncAll(fakeDatabase) | ||
require.NoError(t, err) | ||
|
||
//assert | ||
require.NoError(t, err) | ||
require.Equal(t, 65, resp.TotalResources) | ||
require.Equal(t, 66, len(resp.UpdatedResources)) | ||
} |
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,46 @@ | ||
package internal | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/fastenhealth/fasten-sources/clients/internal/base" | ||
"github.com/fastenhealth/fasten-sources/clients/models" | ||
mock_models "github.com/fastenhealth/fasten-sources/clients/models/mock" | ||
"github.com/fastenhealth/fasten-sources/pkg" | ||
"github.com/golang/mock/gomock" | ||
"github.com/sirupsen/logrus" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestGetSourceClientCigna_SyncAll(t *testing.T) { | ||
// TODO: need to regenerate with _count | ||
// t.Skipf("skipping test, need to regenerate with _count") | ||
t.Parallel() | ||
//setup | ||
testLogger := logrus.WithFields(logrus.Fields{ | ||
"type": "test", | ||
}) | ||
mockCtrl := gomock.NewController(t) | ||
defer mockCtrl.Finish() | ||
fakeDatabase := mock_models.NewMockDatabaseRepository(mockCtrl) | ||
fakeDatabase.EXPECT().UpsertRawResource(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return(true, nil) | ||
fakeDatabase.EXPECT().BackgroundJobCheckpoint(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return() | ||
|
||
fakeSourceCredential := mock_models.NewMockSourceCredential(mockCtrl) | ||
fakeSourceCredential.EXPECT().GetPatientId().AnyTimes().Return("A00000000000005") | ||
fakeSourceCredential.EXPECT().GetPlatformType().AnyTimes().Return(pkg.PlatformTypeCigna) | ||
fakeSourceCredential.EXPECT().GetEndpointId().AnyTimes().Return("6c0454af-1631-4c4d-905d-5710439df983") | ||
|
||
httpClient := base.OAuthVcrSetup(t, false) | ||
client, err := GetDynamicSourceClient(pkg.FastenLighthouseEnvSandbox, context.Background(), testLogger, fakeSourceCredential, models.WithTestHttpClient(httpClient)) | ||
|
||
//test | ||
resp, err := client.SyncAll(fakeDatabase) | ||
require.NoError(t, err) | ||
|
||
//assert | ||
require.NoError(t, err) | ||
require.Equal(t, 29, resp.TotalResources) | ||
require.Equal(t, 21, len(resp.UpdatedResources)) | ||
} |
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,46 @@ | ||
package internal | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/fastenhealth/fasten-sources/clients/internal/base" | ||
"github.com/fastenhealth/fasten-sources/clients/models" | ||
mock_models "github.com/fastenhealth/fasten-sources/clients/models/mock" | ||
"github.com/fastenhealth/fasten-sources/pkg" | ||
"github.com/golang/mock/gomock" | ||
"github.com/sirupsen/logrus" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestGetSourceClientDrChrono_SyncAll(t *testing.T) { | ||
//TODO: need to regenerate with _count | ||
// t.Skipf("skipping test, need to regenerate with _count") | ||
t.Parallel() | ||
//setup | ||
testLogger := logrus.WithFields(logrus.Fields{ | ||
"type": "test", | ||
}) | ||
mockCtrl := gomock.NewController(t) | ||
defer mockCtrl.Finish() | ||
fakeDatabase := mock_models.NewMockDatabaseRepository(mockCtrl) | ||
fakeDatabase.EXPECT().UpsertRawResource(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return(true, nil) | ||
fakeDatabase.EXPECT().BackgroundJobCheckpoint(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return() | ||
|
||
fakeSourceCredential := mock_models.NewMockSourceCredential(mockCtrl) | ||
fakeSourceCredential.EXPECT().GetPatientId().AnyTimes().Return("7670a27f-cb14-475a-ac72-c06a0a8dfea0") | ||
fakeSourceCredential.EXPECT().GetPlatformType().AnyTimes().Return(pkg.PlatformTypeDrChrono) | ||
fakeSourceCredential.EXPECT().GetEndpointId().AnyTimes().Return("6a01ffff-d73e-4728-a315-9b23bd77a4cc") | ||
|
||
httpClient := base.OAuthVcrSetup(t, false) | ||
client, err := GetDynamicSourceClient(pkg.FastenLighthouseEnvSandbox, context.Background(), testLogger, fakeSourceCredential, models.WithTestHttpClient(httpClient)) | ||
|
||
//test | ||
resp, err := client.SyncAll(fakeDatabase) | ||
require.NoError(t, err) | ||
|
||
//assert | ||
require.NoError(t, err) | ||
require.Equal(t, 85, resp.TotalResources) | ||
require.Equal(t, 73, len(resp.UpdatedResources)) | ||
} |
Oops, something went wrong.