Skip to content

Commit

Permalink
updated unit test for ssh
Browse files Browse the repository at this point in the history
  • Loading branch information
SivaanandM committed Sep 11, 2023
1 parent b71ab4a commit cfe8287
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions spectrocloud/resource_ssh_key_test.go
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)
}
}

0 comments on commit cfe8287

Please sign in to comment.