@@ -304,6 +304,43 @@ func TestAddTag_NoExistingTags(t *testing.T) {
304304 }
305305}
306306
307+ func TestAddTag_DomainEntity (t * testing.T ) {
308+ server := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
309+ if r .Method == http .MethodGet {
310+ w .WriteHeader (http .StatusNotFound )
311+ return
312+ }
313+ proposal , aspectJSON := extractProposalWireFormat (t , r .Body )
314+ if proposal ["entityType" ] != "domain" {
315+ t .Errorf ("entityType = %v, want domain" , proposal ["entityType" ])
316+ }
317+ if proposal ["aspectName" ] != "globalTags" {
318+ t .Errorf ("aspectName = %v, want globalTags" , proposal ["aspectName" ])
319+ }
320+ var tags globalTagsAspect
321+ if err := json .Unmarshal ([]byte (aspectJSON ), & tags ); err != nil {
322+ t .Fatalf ("failed to unmarshal inner aspect: %v" , err )
323+ }
324+ if len (tags .Tags ) != 1 {
325+ t .Errorf ("expected 1 tag, got %d" , len (tags .Tags ))
326+ }
327+ w .WriteHeader (http .StatusOK )
328+ }))
329+ defer server .Close ()
330+
331+ c := & Client {
332+ endpoint : server .URL + "/api/graphql" ,
333+ token : "test-token" ,
334+ httpClient : server .Client (),
335+ logger : NopLogger {},
336+ }
337+
338+ err := c .AddTag (context .Background (), "urn:li:domain:engineering" , "urn:li:tag:PII" )
339+ if err != nil {
340+ t .Fatalf ("unexpected error: %v" , err )
341+ }
342+ }
343+
307344func TestRemoveTag (t * testing.T ) {
308345 server := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
309346 if r .Method == http .MethodGet {
@@ -1234,9 +1271,9 @@ func TestLookupDescriptionAspect(t *testing.T) {
12341271 {"container" , "editableContainerProperties" , "description" , false },
12351272 {"dataProduct" , "dataProductProperties" , "description" , false },
12361273 {"glossaryNode" , "glossaryNodeInfo" , "definition" , false },
1274+ {"domain" , "domainProperties" , "description" , false },
1275+ {"glossaryTerm" , "glossaryTermInfo" , "definition" , false },
12371276 // Unsupported types return errors
1238- {"domain" , "" , "" , true },
1239- {"glossaryTerm" , "" , "" , true },
12401277 {"tag" , "" , "" , true },
12411278 {"corpuser" , "" , "" , true },
12421279 }
@@ -1287,6 +1324,20 @@ func TestUpdateDescription_EntityTypes(t *testing.T) {
12871324 wantAspect : "editableContainerProperties" ,
12881325 wantField : "description" ,
12891326 },
1327+ {
1328+ name : "domain" ,
1329+ urn : "urn:li:domain:engineering" ,
1330+ wantEntity : "domain" ,
1331+ wantAspect : "domainProperties" ,
1332+ wantField : "description" ,
1333+ },
1334+ {
1335+ name : "glossaryTerm" ,
1336+ urn : "urn:li:glossaryTerm:Classification" ,
1337+ wantEntity : "glossaryTerm" ,
1338+ wantAspect : "glossaryTermInfo" ,
1339+ wantField : "definition" ,
1340+ },
12901341 }
12911342
12921343 for _ , tt := range tests {
@@ -1356,36 +1407,14 @@ func TestUpdateDescription_UnsupportedEntityType(t *testing.T) {
13561407 }
13571408}
13581409
1359- func TestUpdateDescription_DomainReturnsError (t * testing.T ) {
1360- c := & Client {logger : NopLogger {}}
1361- err := c .UpdateDescription (context .Background (), "urn:li:domain:engineering" , "desc" )
1362- if err == nil {
1363- t .Fatal ("expected error for domain entity" )
1364- }
1365- if ! errors .Is (err , ErrUnsupportedEntityType ) {
1366- t .Errorf ("expected ErrUnsupportedEntityType, got: %v" , err )
1367- }
1368- }
1369-
1370- func TestUpdateDescription_GlossaryTermReturnsError (t * testing.T ) {
1371- c := & Client {logger : NopLogger {}}
1372- err := c .UpdateDescription (context .Background (), "urn:li:glossaryTerm:Classification" , "desc" )
1373- if err == nil {
1374- t .Fatal ("expected error for glossaryTerm entity" )
1375- }
1376- if ! errors .Is (err , ErrUnsupportedEntityType ) {
1377- t .Errorf ("expected ErrUnsupportedEntityType, got: %v" , err )
1378- }
1379- }
1380-
13811410func TestAddTag_UnsupportedEntityType (t * testing.T ) {
13821411 c := & Client {logger : NopLogger {}}
13831412 tests := []struct {
13841413 name string
13851414 urn string
13861415 }{
1387- {"domain " , "urn:li:domain:engineering " },
1388- {"glossaryTerm " , "urn:li:glossaryTerm:Classification " },
1416+ {"tag " , "urn:li:tag:PII " },
1417+ {"corpuser " , "urn:li:corpuser:johndoe " },
13891418 }
13901419 for _ , tt := range tests {
13911420 t .Run (tt .name , func (t * testing.T ) {
@@ -1406,8 +1435,8 @@ func TestRemoveTag_UnsupportedEntityType(t *testing.T) {
14061435 name string
14071436 urn string
14081437 }{
1409- {"domain " , "urn:li:domain:engineering " },
1410- {"glossaryTerm " , "urn:li:glossaryTerm:Classification " },
1438+ {"tag " , "urn:li:tag:PII " },
1439+ {"corpuser " , "urn:li:corpuser:johndoe " },
14111440 }
14121441 for _ , tt := range tests {
14131442 t .Run (tt .name , func (t * testing.T ) {
@@ -1428,8 +1457,8 @@ func TestAddGlossaryTerm_UnsupportedEntityType(t *testing.T) {
14281457 name string
14291458 urn string
14301459 }{
1431- {"domain " , "urn:li:domain:engineering " },
1432- {"glossaryTerm " , "urn:li:glossaryTerm:Classification " },
1460+ {"tag " , "urn:li:tag:PII " },
1461+ {"corpuser " , "urn:li:corpuser:johndoe " },
14331462 }
14341463 for _ , tt := range tests {
14351464 t .Run (tt .name , func (t * testing.T ) {
@@ -1450,8 +1479,8 @@ func TestRemoveGlossaryTerm_UnsupportedEntityType(t *testing.T) {
14501479 name string
14511480 urn string
14521481 }{
1453- {"domain " , "urn:li:domain:engineering " },
1454- {"glossaryTerm " , "urn:li:glossaryTerm:Classification " },
1482+ {"tag " , "urn:li:tag:PII " },
1483+ {"corpuser " , "urn:li:corpuser:johndoe " },
14551484 }
14561485 for _ , tt := range tests {
14571486 t .Run (tt .name , func (t * testing.T ) {
0 commit comments