-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix oc to odo project translation (#6949)
* Fix oc to odo project translation Signed-off-by: Parthvi <[email protected]> * Attempt at fixing regression Signed-off-by: Parthvi <[email protected]> * Add unit test for filteredInformation Signed-off-by: Parthvi <[email protected]> * Use oc command instead of odo Signed-off-by: Parthvi <[email protected]> Co-authored-by: Armel Soro <[email protected]> --------- Signed-off-by: Parthvi <[email protected]> Co-authored-by: Parthvi Vala <[email protected]> Co-authored-by: Armel Soro <[email protected]>
- Loading branch information
1 parent
01a1484
commit abc808b
Showing
2 changed files
with
81 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package auth | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
) | ||
|
||
func Test_filteredInformation(t *testing.T) { | ||
type args struct { | ||
s []byte | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want []byte | ||
}{ | ||
{ | ||
name: "login with no projects", | ||
args: args{ | ||
s: []byte(`Logged into "https://api.crc.testing:6443" as "developer" using existing credentials. | ||
You don't have any projects. You can try to create a new project, by running | ||
oc new-project <projectname>`), | ||
}, | ||
want: []byte(`Logged into "https://api.crc.testing:6443" as "developer" using existing credentials. | ||
You don't have any projects. You can try to create a new project, by running | ||
odo create project <projectname>`), | ||
}, | ||
{ | ||
name: "login with only 1 project", | ||
args: args{ | ||
s: []byte(`Logged into "https://api.crc.testing:6443" as "developer" using existing credentials. | ||
You have one project on this server: "test1" | ||
Using project "test1".`), | ||
}, | ||
want: []byte(`Logged into "https://api.crc.testing:6443" as "developer" using existing credentials. | ||
You have one project on this server: "test1" | ||
Using project "test1".`), | ||
}, | ||
{ | ||
name: "login with more than one project", | ||
args: args{ | ||
s: []byte(`Logged into "https://api.crc.testing:6443" as "developer" using existing credentials. | ||
You have access to the following projects and can switch between them with 'oc project <projectname>': | ||
test1 | ||
test2 | ||
* test3 | ||
Using project "test3".`), | ||
}, | ||
want: []byte(`Logged into "https://api.crc.testing:6443" as "developer" using existing credentials. | ||
You have access to the following projects and can switch between them with 'odo set project <projectname>': | ||
test1 | ||
test2 | ||
* test3 | ||
Using project "test3".`), | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := filteredInformation(tt.args.s); !reflect.DeepEqual(got, tt.want) { | ||
t.Errorf("filteredInformation() = %v\nwant = %v", string(got), string(tt.want)) | ||
} | ||
}) | ||
} | ||
} |