///|
#skip("touches the OS credential store")
test "a secret round-trips through the credential store" {
let service = "my-app"
let account = "alice@example.com"
try {
@keyring.set(service~, account~, secret="s3cret")
match @keyring.get(service~, account~) {
Some(secret) => println("found a secret of \{secret.length()} characters")
None => println("nothing is stored for \{account}")
}
for stored in @keyring.list(service) {
println(stored)
}
@keyring.delete(service~, account~)
} catch {
NoStore(message) => println("no credential store: \{message}")
Refused(code) => println("the store refused the operation: \{code}")
}
}///|
#skip("touches the OS credential store")
test "a secret round-trips through the credential store" {
let service = "my-app"
let account = "alice@example.com"
try {
@keyring.set(service~, account~, secret="s3cret")
match @keyring.get(service~, account~) {
Some(secret) => println("found a secret of \{secret.length()} characters")
None => println("nothing is stored for \{account}")
}
for stored in @keyring.list(service) {
println(stored)
}
@keyring.delete(service~, account~)
} catch {
NoStore(message) => println("no credential store: \{message}")
Refused(code) => println("the store refused the operation: \{code}")
}
}pub suberror KeyringError {
NoStore(String)
Refused(Int)
}#skip("touches the OS credential store")
test {
@keyring.set(service="my-app", account="alice", secret="secret") catch {
NoStore(message) => println(message)
Refused(code) => println("store refused the write: \{code}")
}
}let INTERNAL : Int#skip("touches the OS credential store")
test {
@keyring.delete(service="my-app", account="alice")
}#skip("touches the OS credential store")
test {
match @keyring.get(service="my-app", account="alice") {
Some(token) => ignore(token)
None => ()
}
}#skip("touches the OS credential store")
test {
for account in @keyring.list("my-app") {
ignore(account)
}
}#skip("touches the OS credential store")
test {
@keyring.set(service="my-app", account="alice", secret="secret")
}