Skip to content

Commit

Permalink
tests: fix appending guid in GetbyGuid
Browse files Browse the repository at this point in the history
Signed-off-by: Karanjot Singh <[email protected]>
  • Loading branch information
0xquark committed Dec 5, 2024
1 parent 9d378f4 commit 979a2f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion atlan/assets/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ func GetByGuid[T AtlanObject](guid string) (T, error) {
}

api := &GET_ENTITY_BY_GUID
api.Path += guid
api.Path = fmt.Sprintf("entity/guid/%s", guid) // Adjust to the actual API path structure

response, err := DefaultAtlanClient.CallAPI(api, nil, nil)
if err != nil {
Expand Down
14 changes: 5 additions & 9 deletions atlan/assets/persona_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"github.com/atlanhq/atlan-go/atlan"
"github.com/stretchr/testify/assert"
"testing"
"time"
)

var PersonaName = atlan.MakeUnique("Persona")
Expand All @@ -17,11 +16,8 @@ func TestIntegrationPersona(t *testing.T) {
NewContext()

personaID, personaQualifiedName := testCreatePersona(t)
time.Sleep(5 * time.Second) // Sleep for 2 seconds in order for changes to reflect in platform
testRetrievePersona(t, personaID)
time.Sleep(2 * time.Second) // Sleep for 2 seconds in order for changes to reflect in platform
testUpdatePersona(t, personaQualifiedName)
time.Sleep(2 * time.Second) // Sleep for 2 seconds in order for changes to reflect in platform
testDeletePersona(t, personaID)
}

Expand All @@ -37,12 +33,12 @@ func testCreatePersona(t *testing.T) (string, string) {
assert.Equal(t, 1, len(response.MutatedEntities.CREATE), "number of personas created should be 1")
assert.Equal(t, 0, len(response.MutatedEntities.UPDATE), "number of personas updated should be 0")
assert.Equal(t, 0, len(response.MutatedEntities.DELETE), "number of personas deleted should be 0")
assetone := response.MutatedEntities.CREATE[0]
assert.NotNil(t, assetone, "persona should not be nil")
assert.Equal(t, PersonaName, *assetone.Attributes.Name, "persona name should match")
assert.Equal(t, *p.TypeName, assetone.TypeName, "persona type should match")
CreatedPersona := response.MutatedEntities.CREATE[0]
assert.NotNil(t, CreatedPersona, "persona should not be nil")
assert.Equal(t, PersonaName, *CreatedPersona.Attributes.Name, "persona name should match")
assert.Equal(t, *p.TypeName, CreatedPersona.TypeName, "persona type should match")

return assetone.Guid, *assetone.Attributes.QualifiedName
return CreatedPersona.Guid, *CreatedPersona.Attributes.QualifiedName
}

func testRetrievePersona(t *testing.T, personaID string) {
Expand Down

0 comments on commit 979a2f9

Please sign in to comment.