From ee5a126c1c4b00811fc5dc3ebe31b1b71bb12179 Mon Sep 17 00:00:00 2001 From: James Houlahan Date: Fri, 19 Aug 2022 11:12:34 +0200 Subject: [PATCH] Other(refactor): Implement locations in Bridge --- internal/bridge/bridge_locations.go | 6 +++--- internal/bridge/types.go | 6 +++++- test/context/locations.go | 8 ++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/internal/bridge/bridge_locations.go b/internal/bridge/bridge_locations.go index 1f67dbca..e5502ea8 100644 --- a/internal/bridge/bridge_locations.go +++ b/internal/bridge/bridge_locations.go @@ -1,13 +1,13 @@ package bridge func (bridge *Bridge) ProvideLogsPath() (string, error) { - panic("TODO") + return bridge.locations.ProvideLogsPath() } func (bridge *Bridge) GetLicenseFilePath() string { - panic("TODO") + return bridge.locations.GetLicenseFilePath() } func (bridge *Bridge) GetDependencyLicensesLink() string { - panic("TODO") + return bridge.locations.GetDependencyLicensesLink() } diff --git a/internal/bridge/types.go b/internal/bridge/types.go index 91b986f5..4029debc 100644 --- a/internal/bridge/types.go +++ b/internal/bridge/types.go @@ -24,9 +24,13 @@ import ( ) type Locator interface { + ProvideLogsPath() (string, error) + + GetLicenseFilePath() string + GetDependencyLicensesLink() string + Clear() error ClearUpdates() error - ProvideLogsPath() (string, error) } type CacheProvider interface { diff --git a/test/context/locations.go b/test/context/locations.go index bd7d8f5c..d08be13c 100644 --- a/test/context/locations.go +++ b/test/context/locations.go @@ -45,6 +45,14 @@ func (l *fakeLocations) ProvideSettingsPath() (string, error) { return l.dir, nil } +func (l *fakeLocations) GetDependencyLicensesLink() string { + return "/path/to/dependencies" +} + +func (l *fakeLocations) GetLicenseFilePath() string { + return "/path/to/license" +} + func (l *fakeLocations) Clear() error { return os.RemoveAll(l.dir) }