From 19dd12cd88cb4f8ee93e008751f57751fc9b8299 Mon Sep 17 00:00:00 2001 From: Bennet Gallein Date: Sat, 11 May 2024 21:46:38 +0200 Subject: [PATCH] chore: add tsig tests --- tests/functional/TSIGKeysTest.php | 54 +++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tests/functional/TSIGKeysTest.php diff --git a/tests/functional/TSIGKeysTest.php b/tests/functional/TSIGKeysTest.php new file mode 100644 index 0000000..083b235 --- /dev/null +++ b/tests/functional/TSIGKeysTest.php @@ -0,0 +1,54 @@ +powerdns->tsigkeys(); + $resource = new TSIGKeyResource(); + + $resource->setName($name); + $resource->setAlgorithm(TSIGKeyAlgorithms::HMAC_SHA512); + + $key = $manager->create($resource); + + $this->assertSame(1, $key->count()); + + $created = $key->offsetGet(0); + $this->assertNotEquals("", $created->getKey()); + + // cleanup + $manager->delete($created); + + } + + public function testCreateWithNonUrlFriendlyName(): void { + $name = "this/is/not/aa-_412'aur\\asd-url-friendly"; + + $manager = $this->powerdns->tsigkeys(); + $resource = new TSIGKeyResource(); + + $resource->setName($name); + $resource->setAlgorithm(TSIGKeyAlgorithms::HMAC_SHA512); + + $key = $manager->create($resource); + + $this->assertSame(1, $key->count()); + + $created = $key->offsetGet(0); + $this->assertNotEquals("", $created->getKey()); + + // cleanup + $manager->delete($created); + } + +}