From 49412357b08fdfbf60b7d4545953ddfbe331e82a Mon Sep 17 00:00:00 2001 From: Glenn Sarti Date: Tue, 19 Apr 2022 11:21:37 +0800 Subject: [PATCH] Add Run Tasks entitlement for Organizations This commit adds the beta API changes for the Run Tasks entitlement as per RFC TF-479: * Add run-tasks to Organization entitlement set This commit also adds tests for this beta feature. --- organization.go | 1 + organization_integration_test.go | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/organization.go b/organization.go index 7c17ea885..8b3b3941b 100644 --- a/organization.go +++ b/organization.go @@ -94,6 +94,7 @@ type Entitlements struct { CostEstimation bool `jsonapi:"attr,cost-estimation"` Operations bool `jsonapi:"attr,operations"` PrivateModuleRegistry bool `jsonapi:"attr,private-module-registry"` + RunTasks bool `jsonapi:"attr,run-tasks"` SSO bool `jsonapi:"attr,sso"` Sentinel bool `jsonapi:"attr,sentinel"` StateStorage bool `jsonapi:"attr,state-storage"` diff --git a/organization_integration_test.go b/organization_integration_test.go index 10cafc305..12e884703 100644 --- a/organization_integration_test.go +++ b/organization_integration_test.go @@ -482,3 +482,23 @@ func TestOrganizationsReadRunTasksPermission(t *testing.T) { }) }) } + +func TestOrganizationsReadRunTasksEntitlement(t *testing.T) { + skipIfEnterprise(t) + skipIfFreeOnly(t) + skipIfBeta(t) + + client := testClient(t) + ctx := context.Background() + + orgTest, orgTestCleanup := createOrganization(t, client) + defer orgTestCleanup() + + t.Run("when the org exists", func(t *testing.T) { + entitlements, err := client.Organizations.ReadEntitlements(ctx, orgTest.Name) + require.NoError(t, err) + + assert.NotEmpty(t, entitlements.ID) + assert.True(t, entitlements.RunTasks) + }) +}