mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-16 18:55:11 +00:00
feat: instance domain APIs with relational tables (#11051)
# Which Problems Are Solved This PR implements the endpoints listed in https://github.com/zitadel/zitadel/issues/10444 . # How the Problems Are Solved The implementation follows the same pattern as the Instance one. The `Add` and `Remove` are implementing the `Commander` interface, while `List` Domains endpoints are implementing the `Querier` interace. The PR adds also some forgotten calls to the relational logic for the Instance API. The commits are identifiable by the label `instance:` prepended to them. This is the complete list: bafce01b0 , 6fe7257ab , e27bc9c34 , 8133ede73 , fde667953 , a3e1135ed , ee1a6f9c1 # Additional Context - Closes #10444 --------- Co-authored-by: Elio Bischof <[email protected]> Co-authored-by: Lebogang Phoshoko <[email protected]> Co-authored-by: Wim Van Laer <[email protected]> Co-authored-by: Max Peintner <[email protected]> Co-authored-by: Gayathri Vijayan <[email protected]>
This commit is contained in:
co-authored by
Elio Bischof
Lebogang Phoshoko
Wim Van Laer
Max Peintner
Gayathri Vijayan
parent
d79bfe6eba
commit
b339a3e696
@@ -129,8 +129,9 @@ func TestCommands_RemoveTrustedDomain(t *testing.T) {
|
||||
eventstore func(*testing.T) *eventstore.Eventstore
|
||||
}
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
trustedDomain string
|
||||
ctx context.Context
|
||||
trustedDomain string
|
||||
errorIfNotFound bool
|
||||
}
|
||||
type want struct {
|
||||
details *domain.ObjectDetails
|
||||
@@ -182,20 +183,35 @@ func TestCommands_RemoveTrustedDomain(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "domain does not exists, error",
|
||||
name: "domain does not exist and flag to error set should return error",
|
||||
fields: fields{
|
||||
eventstore: expectEventstore(
|
||||
expectFilter(),
|
||||
),
|
||||
},
|
||||
args: args{
|
||||
ctx: authz.WithInstanceID(context.Background(), "instanceID"),
|
||||
trustedDomain: "domain.com",
|
||||
ctx: authz.WithInstanceID(context.Background(), "instanceID"),
|
||||
trustedDomain: "domain.com",
|
||||
errorIfNotFound: true,
|
||||
},
|
||||
want: want{
|
||||
err: zerrors.ThrowNotFound(nil, "COMMA-de3z9", "Errors.Instance.Domain.NotFound"),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "domain does not exist and flag to error not set should return no error",
|
||||
fields: fields{
|
||||
eventstore: expectEventstore(
|
||||
expectFilter(),
|
||||
),
|
||||
},
|
||||
args: args{
|
||||
ctx: authz.WithInstanceID(context.Background(), "instanceID"),
|
||||
trustedDomain: "domain.com",
|
||||
errorIfNotFound: false,
|
||||
},
|
||||
want: want{},
|
||||
},
|
||||
{
|
||||
name: "domain remove ok",
|
||||
fields: fields{
|
||||
@@ -228,7 +244,7 @@ func TestCommands_RemoveTrustedDomain(t *testing.T) {
|
||||
c := &Commands{
|
||||
eventstore: tt.fields.eventstore(t),
|
||||
}
|
||||
got, err := c.RemoveTrustedDomain(tt.args.ctx, tt.args.trustedDomain)
|
||||
got, err := c.RemoveTrustedDomain(tt.args.ctx, tt.args.trustedDomain, tt.args.errorIfNotFound)
|
||||
assert.ErrorIs(t, err, tt.want.err)
|
||||
assertObjectDetails(t, tt.want.details, got)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user