Rename Go client package from mciasgoclient to mcias
- Update package declaration in client.go - Update error message strings to reference new package name - Update test package and imports to use new name - Update README.md documentation and examples with new package name - All tests pass
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// Package mciasgoclient_test provides tests for the MCIAS Go client.
|
||||
// Package mcias_test provides tests for the MCIAS Go client.
|
||||
// All tests use inline httptest.NewServer mocks to keep this module
|
||||
// self-contained (no cross-module imports).
|
||||
package mciasgoclient_test
|
||||
package mcias_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
@@ -11,16 +11,16 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
mciasgoclient "git.wntrmute.dev/kyle/mcias/clients/go"
|
||||
mcias "git.wntrmute.dev/kyle/mcias/clients/go"
|
||||
)
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// helpers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
func newTestClient(t *testing.T, serverURL string) *mciasgoclient.Client {
|
||||
func newTestClient(t *testing.T, serverURL string) *mcias.Client {
|
||||
t.Helper()
|
||||
c, err := mciasgoclient.New(serverURL, mciasgoclient.Options{})
|
||||
c, err := mcias.New(serverURL, mcias.Options{})
|
||||
if err != nil {
|
||||
t.Fatalf("New: %v", err)
|
||||
}
|
||||
@@ -42,7 +42,7 @@ func writeError(w http.ResponseWriter, status int, msg string) {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
c, err := mciasgoclient.New("https://example.com", mciasgoclient.Options{})
|
||||
c, err := mcias.New("https://example.com", mcias.Options{})
|
||||
if err != nil {
|
||||
t.Fatalf("expected no error, got %v", err)
|
||||
}
|
||||
@@ -52,7 +52,7 @@ func TestNew(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNewWithPresetToken(t *testing.T) {
|
||||
c, err := mciasgoclient.New("https://example.com", mciasgoclient.Options{Token: "preset-tok"})
|
||||
c, err := mcias.New("https://example.com", mcias.Options{Token: "preset-tok"})
|
||||
if err != nil {
|
||||
t.Fatalf("expected no error, got %v", err)
|
||||
}
|
||||
@@ -62,7 +62,7 @@ func TestNewWithPresetToken(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNewBadCACert(t *testing.T) {
|
||||
_, err := mciasgoclient.New("https://example.com", mciasgoclient.Options{CACertPath: "/nonexistent/ca.pem"})
|
||||
_, err := mcias.New("https://example.com", mcias.Options{CACertPath: "/nonexistent/ca.pem"})
|
||||
if err == nil {
|
||||
t.Fatal("expected error for missing CA cert file")
|
||||
}
|
||||
@@ -97,7 +97,7 @@ func TestHealthError(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Fatal("expected error for 503")
|
||||
}
|
||||
var srvErr *mciasgoclient.MciasServerError
|
||||
var srvErr *mcias.MciasServerError
|
||||
if !errors.As(err, &srvErr) {
|
||||
t.Errorf("expected MciasServerError, got %T: %v", err, err)
|
||||
}
|
||||
@@ -183,7 +183,7 @@ func TestLoginUnauthorized(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Fatal("expected error for 401")
|
||||
}
|
||||
var authErr *mciasgoclient.MciasAuthError
|
||||
var authErr *mcias.MciasAuthError
|
||||
if !errors.As(err, &authErr) {
|
||||
t.Errorf("expected MciasAuthError, got %T: %v", err, err)
|
||||
}
|
||||
@@ -312,7 +312,7 @@ func TestConfirmTOTPBadCode(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Fatal("expected error for bad TOTP code")
|
||||
}
|
||||
var inputErr *mciasgoclient.MciasInputError
|
||||
var inputErr *mcias.MciasInputError
|
||||
if !errors.As(err, &inputErr) {
|
||||
t.Errorf("expected MciasInputError, got %T: %v", err, err)
|
||||
}
|
||||
@@ -347,7 +347,7 @@ func TestChangePasswordWrongCurrent(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Fatal("expected error for wrong current password")
|
||||
}
|
||||
var authErr *mciasgoclient.MciasAuthError
|
||||
var authErr *mcias.MciasAuthError
|
||||
if !errors.As(err, &authErr) {
|
||||
t.Errorf("expected MciasAuthError, got %T: %v", err, err)
|
||||
}
|
||||
@@ -456,7 +456,7 @@ func TestCreateAccountConflict(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Fatal("expected error for 409")
|
||||
}
|
||||
var conflictErr *mciasgoclient.MciasConflictError
|
||||
var conflictErr *mcias.MciasConflictError
|
||||
if !errors.As(err, &conflictErr) {
|
||||
t.Errorf("expected MciasConflictError, got %T: %v", err, err)
|
||||
}
|
||||
@@ -801,7 +801,7 @@ func TestListAudit(t *testing.T) {
|
||||
}))
|
||||
defer srv.Close()
|
||||
c := newTestClient(t, srv.URL)
|
||||
resp, err := c.ListAudit(mciasgoclient.AuditFilter{})
|
||||
resp, err := c.ListAudit(mcias.AuditFilter{})
|
||||
if err != nil {
|
||||
t.Fatalf("ListAudit: %v", err)
|
||||
}
|
||||
@@ -827,7 +827,7 @@ func TestListAuditWithFilter(t *testing.T) {
|
||||
}))
|
||||
defer srv.Close()
|
||||
c := newTestClient(t, srv.URL)
|
||||
_, err := c.ListAudit(mciasgoclient.AuditFilter{
|
||||
_, err := c.ListAudit(mcias.AuditFilter{
|
||||
Limit: 10, Offset: 5, EventType: "login_fail", ActorID: "acct-uuid-1",
|
||||
})
|
||||
if err != nil {
|
||||
@@ -896,10 +896,10 @@ func TestCreatePolicyRule(t *testing.T) {
|
||||
}))
|
||||
defer srv.Close()
|
||||
c := newTestClient(t, srv.URL)
|
||||
rule, err := c.CreatePolicyRule(mciasgoclient.CreatePolicyRuleRequest{
|
||||
rule, err := c.CreatePolicyRule(mcias.CreatePolicyRuleRequest{
|
||||
Description: "Test rule",
|
||||
Priority: 50,
|
||||
Rule: mciasgoclient.PolicyRuleBody{Effect: "deny"},
|
||||
Rule: mcias.PolicyRuleBody{Effect: "deny"},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("CreatePolicyRule: %v", err)
|
||||
@@ -950,7 +950,7 @@ func TestGetPolicyRuleNotFound(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Fatal("expected error for 404")
|
||||
}
|
||||
var notFoundErr *mciasgoclient.MciasNotFoundError
|
||||
var notFoundErr *mcias.MciasNotFoundError
|
||||
if !errors.As(err, ¬FoundErr) {
|
||||
t.Errorf("expected MciasNotFoundError, got %T: %v", err, err)
|
||||
}
|
||||
@@ -976,7 +976,7 @@ func TestUpdatePolicyRule(t *testing.T) {
|
||||
}))
|
||||
defer srv.Close()
|
||||
c := newTestClient(t, srv.URL)
|
||||
rule, err := c.UpdatePolicyRule(7, mciasgoclient.UpdatePolicyRuleRequest{Enabled: &enabled})
|
||||
rule, err := c.UpdatePolicyRule(7, mcias.UpdatePolicyRuleRequest{Enabled: &enabled})
|
||||
if err != nil {
|
||||
t.Fatalf("UpdatePolicyRule: %v", err)
|
||||
}
|
||||
@@ -1073,7 +1073,7 @@ func TestIntegration(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Fatal("expected error for wrong credentials")
|
||||
}
|
||||
var authErr *mciasgoclient.MciasAuthError
|
||||
var authErr *mcias.MciasAuthError
|
||||
if !errors.As(err, &authErr) {
|
||||
t.Errorf("expected MciasAuthError, got %T", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user