@@ -807,6 +807,27 @@ func TestPrompt_AppSelectPrompt(t *testing.T) {
807807 Auth : fakeAuthsByTeamDomain [team2TeamDomain ],
808808 },
809809 },
810+ "returns installed application for app environment flag and team id flag if app saved" : {
811+ mockAuths : fakeAuthsByTeamDomainSlice ,
812+ mockAppsLocal : []types.App {
813+ localTeam2InstalledApp ,
814+ },
815+ mockFlagApp : "local" ,
816+ mockFlagTeam : team2TeamID ,
817+ appPromptConfigEnvironment : ShowAllEnvironments ,
818+ appPromptConfigStatus : ShowInstalledAppsOnly ,
819+ expectedSelection : SelectedApp {
820+ App : types.App {
821+ AppID : localTeam2InstalledAppID ,
822+ TeamDomain : team2TeamDomain ,
823+ TeamID : team2TeamID ,
824+ UserID : team2UserID ,
825+ IsDev : true ,
826+ InstallStatus : types .AppStatusInstalled ,
827+ },
828+ Auth : fakeAuthsByTeamDomain [team2TeamDomain ],
829+ },
830+ },
810831 "returns filtered deployed apps for app environment flag before selection" : {
811832 mockAuths : fakeAuthsByTeamDomainSlice ,
812833 mockAppsDeployed : []types.App {
@@ -944,6 +965,7 @@ func TestPrompt_AppSelectPrompt(t *testing.T) {
944965 mockFlagApp : deployedTeam1InstalledAppID ,
945966 mockFlagTeam : team1TeamID ,
946967 appPromptConfigEnvironment : ShowHostedOnly ,
968+ appPromptConfigStatus : ShowAllApps ,
947969 expectedSelection : SelectedApp {
948970 App : types.App {
949971 AppID : deployedTeam1InstalledAppID ,
@@ -966,6 +988,7 @@ func TestPrompt_AppSelectPrompt(t *testing.T) {
966988 mockFlagApp : deployedTeam1InstalledAppID ,
967989 mockFlagTeam : team1TeamDomain ,
968990 appPromptConfigEnvironment : ShowAllEnvironments ,
991+ appPromptConfigStatus : ShowAllApps ,
969992 expectedSelection : SelectedApp {
970993 App : types.App {
971994 AppID : deployedTeam1InstalledAppID ,
@@ -1015,6 +1038,7 @@ func TestPrompt_AppSelectPrompt(t *testing.T) {
10151038 mockFlagApp : "local" ,
10161039 mockFlagTeam : team1TeamID ,
10171040 appPromptConfigEnvironment : ShowAllEnvironments ,
1041+ appPromptConfigStatus : ShowAllApps ,
10181042 expectedSelection : SelectedApp {
10191043 App : types.App {
10201044 AppID : localTeam1UninstalledAppID ,
@@ -1141,6 +1165,20 @@ func TestPrompt_AppSelectPrompt(t *testing.T) {
11411165 Auth : fakeAuthsByTeamDomain [team1TeamDomain ],
11421166 },
11431167 },
1168+ "returns selection for token flag if one app saved" : {
1169+ mockAppsLocal : []types.App {
1170+ localTeam1UninstalledApp ,
1171+ localTeam2InstalledApp ,
1172+ },
1173+ mockAuthWithToken : fakeAuthsByTeamDomain [team2TeamDomain ],
1174+ mockAuthWithTeamIDError : slackerror .New (slackerror .ErrCredentialsNotFound ),
1175+ mockAuthWithTeamIDTeamID : mock .Anything ,
1176+ mockFlagToken : fakeAuthsByTeamDomain [team2TeamDomain ].Token ,
1177+ expectedSelection : SelectedApp {
1178+ App : localTeam2InstalledApp ,
1179+ Auth : fakeAuthsByTeamDomain [team2TeamDomain ],
1180+ },
1181+ },
11441182 "errors if token flag and team id flag do not match" : {
11451183 mockFlagTeam : team1TeamID ,
11461184 mockFlagToken : fakeAuthsByTeamDomain [team2TeamDomain ].Token ,
@@ -1578,8 +1616,6 @@ func Test_ValidateGetOrgWorkspaceGrant(t *testing.T) {
15781616
15791617// Test_ValidateAuth tests edge cases of the reauthentication logic for certain
15801618// errors
1581- //
1582- // Successful reauthentication in other functions might use default mocks below
15831619func Test_ValidateAuth (t * testing.T ) {
15841620 apiHostDev := "https://dev.slack.com"
15851621 tests := map [string ]struct {
0 commit comments