aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/Web
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2019-06-26 21:45:21 -0700
committerzotlabs <mike@macgirvin.com>2019-06-26 21:45:21 -0700
commitcf844cb27c02c3aae636eb1aa1587b1d5e3e81a0 (patch)
treee49ba2b9c90fec0dccceac8b572a76ba2ab41038 /tests/unit/Web
parent4f280b5497325c7e7389096cb39f1f409de2638c (diff)
downloadvolse-hubzilla-cf844cb27c02c3aae636eb1aa1587b1d5e3e81a0.tar.gz
volse-hubzilla-cf844cb27c02c3aae636eb1aa1587b1d5e3e81a0.tar.bz2
volse-hubzilla-cf844cb27c02c3aae636eb1aa1587b1d5e3e81a0.zip
http signature consolidation
Diffstat (limited to 'tests/unit/Web')
-rw-r--r--tests/unit/Web/HttpSigTest.php27
1 files changed, 6 insertions, 21 deletions
diff --git a/tests/unit/Web/HttpSigTest.php b/tests/unit/Web/HttpSigTest.php
index 9909a9883..db0f9700f 100644
--- a/tests/unit/Web/HttpSigTest.php
+++ b/tests/unit/Web/HttpSigTest.php
@@ -43,45 +43,30 @@ class PermissionDescriptionTest extends UnitTestCase {
function testGenerate_digest($text, $digest) {
$this->assertSame(
$digest,
- HTTPSig::generate_digest($text, false)
+ HTTPSig::generate_digest_header($text)
);
}
public function generate_digestProvider() {
return [
'empty body text' => [
'',
- '47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='
+ 'SHA-256=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='
],
'sample body text' => [
'body text',
- '2fu8kUkvuzuo5XyhWwORNOcJgDColXgxWkw1T5EXzPI='
+ 'SHA-256=2fu8kUkvuzuo5XyhWwORNOcJgDColXgxWkw1T5EXzPI='
],
'NULL body text' => [
null,
- '47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='
+ 'SHA-256=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='
],
];
}
function testGeneratedDigestsOfDifferentTextShouldNotBeEqual() {
$this->assertNotSame(
- HTTPSig::generate_digest('text1', false),
- HTTPSig::generate_digest('text2', false)
- );
- }
-
- /**
- * Process separation needed for header() check.
- * @runInSeparateProcess
- */
- function testGenerate_digestSendsHttpHeader() {
- $ret = HTTPSig::generate_digest('body text', true);
-
- $this->assertSame('2fu8kUkvuzuo5XyhWwORNOcJgDColXgxWkw1T5EXzPI=', $ret);
- $this->assertContains(
- 'Digest: SHA-256=2fu8kUkvuzuo5XyhWwORNOcJgDColXgxWkw1T5EXzPI=',
- xdebug_get_headers(),
- 'HTTP header Digest does not match'
+ HTTPSig::generate_digest_header('text1'),
+ HTTPSig::generate_digest_header('text2')
);
}