diff --git a/Tests/SSHCreateKeyTests/ArgumentsCreatSSHKeys.swift b/Tests/SSHCreateKeyTests/ArgumentsCreatSSHKeys.swift index f71233ebbd30da3962e39fb69c99ce7bf05c1f95..7aa62216939289aa2c183710a85295bd78da4074 100644 --- a/Tests/SSHCreateKeyTests/ArgumentsCreatSSHKeys.swift +++ b/Tests/SSHCreateKeyTests/ArgumentsCreatSSHKeys.swift @@ -19,25 +19,13 @@ struct ArgumentsCreatSSHKeys { let userHomeDirectoryPathdefault = "/Users/thomas" let sshkeypathandidentityfiledefault = "/Users/thomas/.ssh/id_rsa" let argumentssshcopyiddefault = "/usr/bin/ssh-copy-id -i /Users/thomas/.ssh/id_rsa thomas@raspberrypi" + + + let URLfilelocal: URL? = URL(fileURLWithPath: "/Users/thomas/.ssh/") + let sshcreatelocal = ["-t", "rsa", "-N", "", "-f", "/Users/thomas/.ssh/id_rsa"] + + + let URLfileglobal = URL(fileURLWithPath:"/Users/thomas/.ssh_global") + let sshcreateglobal = ["-t", "rsa", "-N", "", "-f", "/Users/thomas/.ssh_global/global"] - /* - /Users/thomas/.ssh - id_rsa - /Users/thomas - /Users/thomas/.ssh/id_rsa - /usr/bin/ssh-copy-id -i /Users/thomas/.ssh/id_rsa thomas@raspberrypi - */ - - /* - let arg3 = await sshcreatekey.keypathonly - print(arg3 ?? "") - let arg4 = await sshcreatekey.identityfile - print(arg4 ?? "") - let arg5 = await sshcreatekey.userHomeDirectoryPath - print(arg5 ?? "") - let arg6 = await sshcreatekey.sshkeypathandidentityfile - print(arg6 ?? "") - let arg7 = await sshcreatekey.argumentssshcopyid(offsiteServer: "raspberrypi", offsiteUsername: "thomas") - pri - */ } diff --git a/Tests/SSHCreateKeyTests/SSHCreateKeyTests.swift b/Tests/SSHCreateKeyTests/SSHCreateKeyTests.swift index e0c6049604337b46b9adc604569630a1509e0a63..6a049d76f2695af1fd1de26b61e9bc9d16ea1efe 100644 --- a/Tests/SSHCreateKeyTests/SSHCreateKeyTests.swift +++ b/Tests/SSHCreateKeyTests/SSHCreateKeyTests.swift @@ -1,5 +1,6 @@ @testable import SSHCreateKey import Testing +import Foundation @Suite final class TestCreateSSHkeys { var testconfigurations: [TestSynchronizeConfiguration]? @@ -28,7 +29,7 @@ import Testing await loadtestdata.getdata() testconfigurations = loadtestdata.testconfigurations - // Sett Shareddata to nil oe default values + // Sett Shareddata to nil or default values let port = -1 let identityfile: String? = nil let sshcreatekey = await SSHCreateKey(sharedsshport: String(port), @@ -53,10 +54,10 @@ import Testing sharedsshkeypathandidentityfile: TestSharedReference.shared.sshkeypathandidentityfile) // If new keypath is set create it let sshrootpath = await sshcreatekey.testcreatesshkeyrootpath() + #expect(ArgumentsCreatSSHKeys().URLfileglobal == sshrootpath) // Create keys let arguments = await sshcreatekey.argumentscreatekey() - print(sshrootpath ?? "") - print(arguments ?? "") + #expect(ArgumentsCreatSSHKeys().sshcreateglobal == arguments) } @Test func createkeysdefault() async { @@ -68,10 +69,8 @@ import Testing sharedsshkeypathandidentityfile: identityfile) let sshrootpath = await sshcreatekey.testcreatesshkeyrootpath() - // Create keys + #expect(ArgumentsCreatSSHKeys().URLfilelocal == sshrootpath) let arguments = await sshcreatekey.argumentscreatekey() - print(sshrootpath ?? "") - print(arguments ?? "") - + #expect(ArgumentsCreatSSHKeys().sshcreatelocal == arguments) } }