@@ -58,8 +58,6 @@ import (
5858 "github.com/specterops/bloodhound/cmd/api/src/utils/test"
5959 "github.com/specterops/bloodhound/cmd/api/src/utils/validation"
6060 "github.com/specterops/bloodhound/packages/go/bhlog"
61- "github.com/specterops/bloodhound/packages/go/graphschema/ad"
62- "github.com/specterops/bloodhound/packages/go/graphschema/azure"
6361 "github.com/specterops/bloodhound/packages/go/graphschema/common"
6462 "github.com/specterops/bloodhound/packages/go/headers"
6563 "github.com/specterops/bloodhound/packages/go/mediatypes"
@@ -1586,17 +1584,9 @@ func TestCreateUser_ETAC(t *testing.T) {
15861584 },
15871585 },
15881586 expectMocks : func (mockDB * mocks.MockDatabase , goodUser model.User , mockGraphDB * mocks_graph.MockGraph ) {
1589- mockGraphDB .EXPECT ().FetchNodesByObjectIDsAndKinds (gomock .Any (), graph.Kinds {ad .Domain , azure .Tenant }, []string {"12345" , "54321" }).Return (graph.NodeSet {
1590- graph .ID (1 ): {
1591- Properties : graph .AsProperties (map [string ]any {
1592- common .ObjectID .String (): "12345" ,
1593- }),
1594- },
1595- graph .ID (2 ): {
1596- Properties : graph .AsProperties (map [string ]any {
1597- common .ObjectID .String (): "54321" ,
1598- }),
1599- },
1587+ mockGraphDB .EXPECT ().GetFilteredAndSortedNodes (gomock .Any (), gomock .Any ()).Return ([]* graph.Node {
1588+ {Properties : graph .AsProperties (map [string ]any {common .ObjectID .String (): "12345" })},
1589+ {Properties : graph .AsProperties (map [string ]any {common .ObjectID .String (): "54321" })},
16001590 }, nil )
16011591 mockDB .EXPECT ().CreateUser (gomock .Any (), gomock .Any ()).Return (goodUser , nil ).AnyTimes ()
16021592 },
@@ -1732,17 +1722,13 @@ func TestCreateUser_ETAC(t *testing.T) {
17321722 },
17331723 },
17341724 expectMocks : func (mockDB * mocks.MockDatabase , goodUser model.User , mockGraphDB * mocks_graph.MockGraph ) {
1735- mockGraphDB .EXPECT ().FetchNodesByObjectIDsAndKinds (gomock .Any (), graph.Kinds {ad .Domain , azure .Tenant }, []string {"12345" , "54321" }).Return (graph.NodeSet {
1736- graph .ID (1 ): {
1737- Properties : graph .AsProperties (map [string ]any {
1738- common .ObjectID .String (): "12345" ,
1739- }),
1740- },
1725+ mockGraphDB .EXPECT ().GetFilteredAndSortedNodes (gomock .Any (), gomock .Any ()).Return ([]* graph.Node {
1726+ {Properties : graph .AsProperties (map [string ]any {common .ObjectID .String (): "12345" })},
17411727 }, nil )
17421728 },
17431729 expectedStatus : http .StatusBadRequest ,
17441730 assertBody : func (t * testing.T , body string ) {
1745- assert .Contains (t , body , "domain or tenant not found: 54321" )
1731+ assert .Contains (t , body , "environment not found: 54321" )
17461732 },
17471733 },
17481734 }
@@ -2995,12 +2981,8 @@ func TestManagementResource_UpdateUser_ETAC(t *testing.T) {
29952981 expectedStatus : http .StatusOK ,
29962982 assertBody : func (t * testing.T , _ string ) {},
29972983 expectMocks : func (mockDB * mocks.MockDatabase , goodUser model.User , mockGraphDB * mocks_graph.MockGraph ) {
2998- mockGraphDB .EXPECT ().FetchNodesByObjectIDsAndKinds (gomock .Any (), graph.Kinds {ad .Domain , azure .Tenant }, []string {"12345" }).Return (graph.NodeSet {
2999- graph .ID (1 ): {
3000- Properties : graph .AsProperties (map [string ]any {
3001- common .ObjectID .String (): "12345" ,
3002- }),
3003- },
2984+ mockGraphDB .EXPECT ().GetFilteredAndSortedNodes (gomock .Any (), gomock .Any ()).Return ([]* graph.Node {
2985+ {Properties : graph .AsProperties (map [string ]any {common .ObjectID .String (): "12345" })},
30042986 }, nil )
30052987 mockDB .EXPECT ().UpdateUser (gomock .Any (), gomock .Any ()).Return (nil )
30062988 },
@@ -3086,15 +3068,11 @@ func TestManagementResource_UpdateUser_ETAC(t *testing.T) {
30863068 },
30873069 expectedStatus : http .StatusBadRequest ,
30883070 assertBody : func (t * testing.T , body string ) {
3089- assert .Contains (t , body , "domain or tenant not found: 54321" )
3071+ assert .Contains (t , body , "environment not found: 54321" )
30903072 },
30913073 expectMocks : func (mockDB * mocks.MockDatabase , goodUser model.User , mockGraphDB * mocks_graph.MockGraph ) {
3092- mockGraphDB .EXPECT ().FetchNodesByObjectIDsAndKinds (gomock .Any (), graph.Kinds {ad .Domain , azure .Tenant }, []string {"12345" , "54321" }).Return (graph.NodeSet {
3093- graph .ID (1 ): {
3094- Properties : graph .AsProperties (map [string ]any {
3095- common .ObjectID .String (): "12345" ,
3096- }),
3097- },
3074+ mockGraphDB .EXPECT ().GetFilteredAndSortedNodes (gomock .Any (), gomock .Any ()).Return ([]* graph.Node {
3075+ {Properties : graph .AsProperties (map [string ]any {common .ObjectID .String (): "12345" })},
30983076 }, nil )
30993077 },
31003078 },
0 commit comments