30 lines
858 B
Swift
30 lines
858 B
Swift
import CodexBarCore
|
|
import Foundation
|
|
import Testing
|
|
|
|
struct TailscaleSessionTests {
|
|
@Test
|
|
func `online mac and linux peers become hosts`() throws {
|
|
let url = try AgentSessionParserTests.fixtureURL("agent-sessions-tailscale", extension: "json")
|
|
let hosts = try TailscaleStatusParser.hosts(
|
|
from: Data(contentsOf: url),
|
|
excludingLocalHost: "local-mac")
|
|
|
|
#expect(hosts == ["clawmac", "linuxbox"])
|
|
}
|
|
|
|
@Test
|
|
func `ssh destinations reject options whitespace and controls`() {
|
|
let hosts = RemoteSessionFetcher.sanitizedHosts([
|
|
"user@clawmac",
|
|
"USER@CLAWMAC",
|
|
"-oProxyCommand=touch /tmp/unsafe",
|
|
"host with-space",
|
|
"host\nother",
|
|
"linuxbox",
|
|
])
|
|
|
|
#expect(hosts == ["user@clawmac", "linuxbox"])
|
|
}
|
|
}
|