Skip to content

Commit

Permalink
fix references to NetBoxBranchParam and NetBoxBranchHeader
Browse files Browse the repository at this point in the history
  • Loading branch information
ltucker committed Dec 16, 2024
1 parent a057571 commit 814387d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions diode-server/netboxdiodeplugin/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ func (c *Client) RetrieveObjectState(ctx context.Context, params RetrieveObjectS
}
branchID := strings.TrimSpace(params.BranchID)
if branchID != "" {
queryParams.Set(NetboxBranchParam, branchID)
queryParams.Set(NetBoxBranchParam, branchID)
}
for k, v := range params.Params {
queryParams.Set(k, v)
Expand Down Expand Up @@ -444,7 +444,7 @@ func (c *Client) ApplyChangeSet(ctx context.Context, payload ChangeSetRequest) (

branchID := strings.TrimSpace(payload.BranchID)
if branchID != "" {
req.Header.Set(NetboxBranchHeader, branchID)
req.Header.Set(NetBoxBranchHeader, branchID)
}

resp, err := c.httpClient.Do(req)
Expand Down
8 changes: 4 additions & 4 deletions diode-server/netboxdiodeplugin/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,9 @@ func TestRetrieveObjectState(t *testing.T) {
assert.Equal(t, r.Header.Get("Authorization"), fmt.Sprintf("Token %s", tt.apiKey))
assert.Equal(t, r.Header.Get("User-Agent"), fmt.Sprintf("%s/%s", netboxdiodeplugin.SDKName, netboxdiodeplugin.SDKVersion))
if tt.params.BranchID != "" {
assert.Equal(t, r.URL.Query().Get("_branch"), tt.params.BranchID)
assert.Equal(t, r.URL.Query().Get(netboxdiodeplugin.NetBoxBranchParam), tt.params.BranchID)
} else {
assert.False(t, r.URL.Query().Has("_branch"))
assert.False(t, r.URL.Query().Has(netboxdiodeplugin.NetBoxBranchParam))
}
_, _ = w.Write([]byte(tt.mockServerResponse))
}
Expand Down Expand Up @@ -774,9 +774,9 @@ func TestApplyChangeSet(t *testing.T) {
assert.Equal(t, r.Header.Get("User-Agent"), fmt.Sprintf("%s/%s", netboxdiodeplugin.SDKName, netboxdiodeplugin.SDKVersion))
assert.Equal(t, r.Header.Get("Content-Type"), "application/json")
if tt.changeSetRequest.BranchID != "" {
assert.Equal(t, r.Header.Get("X-Netbox-Branch"), tt.changeSetRequest.BranchID)
assert.Equal(t, r.Header.Get(netboxdiodeplugin.NetBoxBranchHeader), tt.changeSetRequest.BranchID)
} else {
assert.Len(t, r.Header.Values("X-Netbox-Branch"), 0)
assert.Len(t, r.Header.Values(netboxdiodeplugin.NetBoxBranchHeader), 0)
}
w.WriteHeader(tt.mockStatusCode)
_, _ = w.Write([]byte(tt.mockServerResponse))
Expand Down

0 comments on commit 814387d

Please sign in to comment.