Skip to content

Commit

Permalink
test(hass/api): ✅ fix test to use new config embed in context
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuar committed Jan 12, 2024
1 parent 95c2176 commit f8ba873
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 37 deletions.
33 changes: 0 additions & 33 deletions internal/hass/api/context.go

This file was deleted.

10 changes: 6 additions & 4 deletions internal/hass/api/request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"reflect"
"testing"

"github.com/joshuar/go-hass-agent/internal/agent/config"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -95,10 +96,11 @@ func Test_marshalJSON(t *testing.T) {
func TestExecuteRequest(t *testing.T) {
mockServer := mockServer(t)
defer mockServer.Close()
mockConfig := &APIConfig{
APIURL: mockServer.URL,
}
ctx := NewContext(context.TODO(), mockConfig)
cfg, err := config.Load(t.TempDir())
assert.Nil(t, err)
err = cfg.Set(config.PrefAPIURL, mockServer.URL)
assert.Nil(t, err)
ctx := config.EmbedInContext(context.TODO(), cfg)
mockReq := &RequestMock{
RequestDataFunc: func() json.RawMessage {
return json.RawMessage(`{"someField": "someValue"}`)
Expand Down

0 comments on commit f8ba873

Please sign in to comment.