From 3edd692b183e1dc533f438362cd5067e0077b8bc Mon Sep 17 00:00:00 2001 From: Fredrik Berntsson Date: Fri, 7 Mar 2025 17:47:22 +0100 Subject: [PATCH] Add missing client test and debug logs --- internal/pihole/client.go | 1 + internal/pihole/client_test.go | 6 ++++++ internal/sync/sync.go | 4 +--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/internal/pihole/client.go b/internal/pihole/client.go index 78a84da..412ee66 100644 --- a/internal/pihole/client.go +++ b/internal/pihole/client.go @@ -115,6 +115,7 @@ func (client *client) DeleteSession() error { } if client.auth.sid == "" { + log.Debug().Msg("Trying to delete empty session") return nil } diff --git a/internal/pihole/client_test.go b/internal/pihole/client_test.go index b6825c4..89ee85d 100644 --- a/internal/pihole/client_test.go +++ b/internal/pihole/client_test.go @@ -106,6 +106,12 @@ func (suite *clientTestSuite) TestClient_PatchConfig() { assert.NoError(suite.T(), err) } +func (suite *clientTestSuite) TestClient_PostRunGravity() { + err := suite.client.PostRunGravity() + + assert.NoError(suite.T(), err) +} + func TestClient_String(t *testing.T) { piHole := model.NewPiHole("http://asdfasdf.com:1234", apiPassword) s := NewClient(piHole, httpClient).String() diff --git a/internal/sync/sync.go b/internal/sync/sync.go index d3303d0..9624294 100644 --- a/internal/sync/sync.go +++ b/internal/sync/sync.go @@ -122,9 +122,7 @@ func createPatchConfigRequest(config *config.ConfigSettings, configResponse *mod patchConfig := model.PatchConfig{} if config.DNS { - i := configResponse.Config["dns"] - m := i.(map[string]interface{}) - patchConfig.DNS = m + patchConfig.DNS = configResponse.Config["dns"].(map[string]interface{}) } if config.DHCP { patchConfig.DHCP = configResponse.Config["dhcp"].(map[string]interface{})