(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func TestPromptScopes(t *testing.T) { |
| 13 | pa := []*testutil.PA{ |
| 14 | testutil.NewMultiSelectPrompt("Environment scope", "", []string{"test"}, []string{"test"}), |
| 15 | testutil.NewMultiSelectPrompt("Process scope", "", []string{"Run, book, run"}, []string{"Run, book, run"}), |
| 16 | testutil.NewMultiSelectPrompt("Channel scope", "", []string{"Default channel"}, []string{"Default channel"}), |
| 17 | testutil.NewMultiSelectPrompt("Target scope", "", []string{"Deployment target"}, []string{"Deployment target"}), |
| 18 | testutil.NewMultiSelectPrompt("Role scope", "", []string{"Role 1"}, []string{"Role 1"}), |
| 19 | testutil.NewMultiSelectPrompt("Tag scope", "", []string{"tag set/tag 1"}, []string{"tag set/tag 1"}), |
| 20 | testutil.NewMultiSelectPrompt("Step scope", "", []string{"Step name"}, []string{"Step name"}), |
| 21 | } |
| 22 | |
| 23 | variable := variables.NewVariable("") |
| 24 | variable.ID = "123abc" |
| 25 | variableSet := &variables.VariableSet{ |
| 26 | OwnerID: "Projects-1", |
| 27 | ScopeValues: &variables.VariableScopeValues{ |
| 28 | Environments: []*resources.ReferenceDataItem{{ID: "Environments-1", Name: "test"}}, |
| 29 | Actions: []*resources.ReferenceDataItem{{ID: "actionId", Name: "Step name"}}, |
| 30 | Channels: []*resources.ReferenceDataItem{{ID: "Channels-1", Name: "Default channel"}}, |
| 31 | Machines: []*resources.ReferenceDataItem{{ID: "Machines-1", Name: "Deployment target"}}, |
| 32 | TenantTags: []*resources.ReferenceDataItem{{ID: "tag set/tag 1", Name: "tag 1"}}, |
| 33 | Roles: []*resources.ReferenceDataItem{{ID: "Role 1", Name: "Role 1"}}, |
| 34 | Processes: []*resources.ProcessReferenceDataItem{{ID: "Runbooks-1", Name: "Run, book, run"}}, |
| 35 | }, |
| 36 | SpaceID: "Spaces-1", |
| 37 | Variables: []*variables.Variable{variable}, |
| 38 | } |
| 39 | |
| 40 | asker, checkRemainingPrompts := testutil.NewMockAsker(t, pa) |
| 41 | |
| 42 | flags := shared.NewScopeFlags() |
| 43 | err := shared.PromptScopes(asker, variableSet, flags, false) |
| 44 | |
| 45 | assert.NoError(t, err) |
| 46 | checkRemainingPrompts() |
| 47 | } |
| 48 | |
| 49 | func TestPromptScopes_Prompted(t *testing.T) { |
| 50 | pa := []*testutil.PA{ |
nothing calls this directly
no test coverage detected