Skip to content

Commit

Permalink
Test: Add test for asserting no-code permissions for org
Browse files Browse the repository at this point in the history
  • Loading branch information
briancain committed Aug 27, 2024
1 parent cfee3d8 commit b5de3c9
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions organization_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,29 @@ func TestOrganizationsCreate(t *testing.T) {
})
}

func TestOrganizationsReadWithBusiness(t *testing.T) {
client := testClient(t)
ctx := context.Background()

orgTest, orgTestCleanup := createOrganization(t, client)
t.Cleanup(orgTestCleanup)
// With Business
newSubscriptionUpdater(orgTest).WithBusinessPlan().Update(t)

t.Run("when the org exists", func(t *testing.T) {
org, err := client.Organizations.Read(ctx, orgTest.Name)
require.NoError(t, err)
assert.Equal(t, orgTest, org)
assert.NotEmpty(t, org.Permissions)

t.Run("permissions are properly decoded", func(t *testing.T) {
assert.True(t, org.Permissions.CanDestroy)
assert.True(t, org.Permissions.CanDeployNoCodeModules)
assert.True(t, org.Permissions.CanManageNoCodeModules)
})
})
}

func TestOrganizationsRead(t *testing.T) {
client := testClient(t)
ctx := context.Background()
Expand All @@ -166,6 +189,8 @@ func TestOrganizationsRead(t *testing.T) {

t.Run("permissions are properly decoded", func(t *testing.T) {
assert.True(t, org.Permissions.CanDestroy)
assert.False(t, org.Permissions.CanDeployNoCodeModules)
assert.False(t, org.Permissions.CanManageNoCodeModules)
})

t.Run("timestamps are populated", func(t *testing.T) {
Expand Down

0 comments on commit b5de3c9

Please sign in to comment.