From 21cd4a1b4845858c3421dbd5f2673eceee421f5d Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 26 Nov 2020 08:43:03 +0000 Subject: psr-4 autoloading standard --- tests/unit/Web/HttpSigTest.php | 112 ----------------------------------------- 1 file changed, 112 deletions(-) delete mode 100644 tests/unit/Web/HttpSigTest.php (limited to 'tests/unit/Web') diff --git a/tests/unit/Web/HttpSigTest.php b/tests/unit/Web/HttpSigTest.php deleted file mode 100644 index db0f9700f..000000000 --- a/tests/unit/Web/HttpSigTest.php +++ /dev/null @@ -1,112 +0,0 @@ -assertSame( - $digest, - HTTPSig::generate_digest_header($text) - ); - } - public function generate_digestProvider() { - return [ - 'empty body text' => [ - '', - 'SHA-256=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=' - ], - 'sample body text' => [ - 'body text', - 'SHA-256=2fu8kUkvuzuo5XyhWwORNOcJgDColXgxWkw1T5EXzPI=' - ], - 'NULL body text' => [ - null, - 'SHA-256=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=' - ], - ]; - } - - function testGeneratedDigestsOfDifferentTextShouldNotBeEqual() { - $this->assertNotSame( - HTTPSig::generate_digest_header('text1'), - HTTPSig::generate_digest_header('text2') - ); - } - - /** - * @uses ::crypto_unencapsulate - */ - function testDecrypt_sigheader() { - $header = 'Header: iv="value_iv" key="value_key" alg="value_alg" data="value_data"'; - $result = [ - 'encrypted' => true, - 'iv' => 'value_iv', - 'key' => 'value_key', - 'alg' => 'value_alg', - 'data' => 'value_data' - ]; - - $this->assertSame($result, HTTPSig::decrypt_sigheader($header, 'site private key')); - } - /** - * @uses ::crypto_unencapsulate - */ - function testDecrypt_sigheaderUseSitePrivateKey() { - // Create a stub for global function get_config() with expectation - $t = $this->getFunctionMock('Zotlabs\Web', 'get_config'); - $t->expects($this->once())->willReturn('system.prvkey'); - - $header = 'Header: iv="value_iv" key="value_key" alg="value_alg" data="value_data"'; - $result = [ - 'encrypted' => true, - 'iv' => 'value_iv', - 'key' => 'value_key', - 'alg' => 'value_alg', - 'data' => 'value_data' - ]; - - $this->assertSame($result, HTTPSig::decrypt_sigheader($header)); - } - function testDecrypt_sigheaderIncompleteHeaderShouldReturnEmptyString() { - $header = 'Header: iv="value_iv" key="value_key"'; - - $this->assertEmpty(HTTPSig::decrypt_sigheader($header, 'site private key')); - } -} -- cgit v1.2.3