Skip to content

Commit 265bf1b

Browse files
committed
test(authz): centralize test constants
1 parent 47bdcd6 commit 265bf1b

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

services/authz/server/server_test.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,6 @@ func createTestServer(t *testing.T) *Server {
153153

154154
// TestServer_envoyAuthHandler tests the Envoy auth handler
155155
func TestServer_envoyAuthHandler(t *testing.T) {
156-
const (
157-
testDeviceID = "test-device"
158-
testAllowPath = "/v1/data/keep/allow"
159-
testClientRemoteIP = "100.65.1.1:12345"
160-
)
161156
// Create mock OPA server
162157
mockOPA := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
163158
if r.URL.Path == testAllowPath && r.Method == http.MethodPost {
@@ -437,7 +432,7 @@ func TestServer_lookupDevice(t *testing.T) {
437432
result := server.lookupDevice(context.Background(), testDeviceID)
438433

439434
expected := map[string]any{
440-
"id": "test-device",
435+
"id": testDeviceID,
441436
"posture": "unknown",
442437
}
443438

@@ -511,7 +506,7 @@ func TestServer_lookupDevice(t *testing.T) {
511506

512507
server := createTestServerWithMocks(t, "", mockInventory.URL)
513508

514-
result := server.lookupDevice(ctx, "test-device")
509+
result := server.lookupDevice(ctx, testDeviceID)
515510

516511
if result["posture"] != "unknown" {
517512
t.Errorf("Expected posture 'unknown' for service error, got %v", result["posture"])

0 commit comments

Comments
 (0)