-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b71ab4a
commit cfe8287
Showing
1 changed file
with
24 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package spectrocloud | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestToSSHKey(t *testing.T) { | ||
// Create a sample ResourceData object | ||
d := resourceSSHKey().TestResourceData() | ||
name := "testSSHName" | ||
sshKey := "ssh-rsa AAAA6IEQhI1QLiicHLO5a== teerf2021" | ||
d.Set("name", name) | ||
d.Set("ssh_key", sshKey) | ||
|
||
result := toSSHKey(d) | ||
|
||
if result.Metadata.Name != name { | ||
t.Errorf("Expected Metadata Name to be %s, but got %s", name, result.Metadata.Name) | ||
} | ||
|
||
if result.Spec.PublicKey != sshKey { | ||
t.Errorf("Expected Spec PublicKey to be %s, but got %s", sshKey, result.Spec.PublicKey) | ||
} | ||
} |