2
0
mirror of https://github.com/VinylDNS/vinyldns synced 2025-08-22 02:02:14 +00:00

Merge pull request #1171 from Aravindh-Raju/aravindhr/override-toString-ZoneConnection

Override ZoneConnection toString
This commit is contained in:
Nicholas Spadaccino 2022-11-07 15:48:52 -05:00 committed by GitHub
commit c6bca186b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View File

@ -241,5 +241,15 @@ class ZoneConnectionValidatorSpec
underTest.isValidBackendId(Some("bad")) shouldBe left
}
}
"Zone Connection toString" should {
"not display key and algorithm" in {
zc.toString shouldBe "ZoneConnection: [name=\"zc.\"; keyName=\"zc.\"; primaryServer=\"10.1.1.1\"; ]"
}
"not display key and algorithm while displaying connection and transferConnection of a Zone" in {
val zoneString = s"""Zone: [id="${testZone.id}"; name="vinyldns."; account="system"; adminGroupId="system"; status="Active"; shared="false"; connection="Some(ZoneConnection: [name="vinyldns."; keyName="vinyldns."; primaryServer="10.1.1.1"; ])"; transferConnection="Some(ZoneConnection: [name="vinyldns."; keyName="vinyldns."; primaryServer="10.1.1.1"; ])"; reverse="false"; isTest="false"; created="${testZone.created}"; ]"""
testZone.toString shouldBe zoneString
}
}
}
}

View File

@ -188,6 +188,16 @@ case class ZoneConnection(
def decrypted(crypto: CryptoAlgebra): ZoneConnection =
copy(key = crypto.decrypt(key))
override def toString: String = {
val sb = new StringBuilder
sb.append("ZoneConnection: [")
sb.append("name=\"").append(name).append("\"; ")
sb.append("keyName=\"").append(keyName).append("\"; ")
sb.append("primaryServer=\"").append(primaryServer).append("\"; ")
sb.append("]")
sb.toString
}
}
final case class LegacyDnsBackend(