-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chor: implement tests for fhir usecases methods (#42)
- Loading branch information
1 parent
4ef52a5
commit caccecc
Showing
7 changed files
with
5,207 additions
and
119 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
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package helpers | ||
|
||
import ( | ||
"io/ioutil" | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/labstack/gommon/log" | ||
"github.com/savannahghi/interserviceclient" | ||
"gopkg.in/yaml.v2" | ||
) | ||
|
||
// InitializeInterServiceClient initializes an external service in the correct environment given its name | ||
func InitializeInterServiceClient(serviceName string) *interserviceclient.InterServiceClient { | ||
//os file and parse it to go type | ||
file, err := ioutil.ReadFile(filepath.Clean(interserviceclient.PathToDepsFile())) | ||
if err != nil { | ||
log.Errorf("error occurred while opening deps file %v", err) | ||
os.Exit(1) | ||
} | ||
var config interserviceclient.DepsConfig | ||
if err := yaml.Unmarshal(file, &config); err != nil { | ||
log.Errorf("failed to unmarshal yaml config file %v", err) | ||
os.Exit(1) | ||
} | ||
|
||
client, err := interserviceclient.SetupISCclient(config, serviceName) | ||
if err != nil { | ||
log.Panicf("unable to initialize inter service client for %v service: %s", err, serviceName) | ||
} | ||
return client | ||
} |
Oops, something went wrong.