Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3979753
D213.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D213.diff
View Options
diff --git a/tests/Http/Controllers/GitHubGateControllerTest.php b/tests/Http/Controllers/GitHubGateControllerTest.php
--- a/tests/Http/Controllers/GitHubGateControllerTest.php
+++ b/tests/Http/Controllers/GitHubGateControllerTest.php
@@ -27,7 +27,7 @@
public function testPost () {
$payload = file_get_contents(__DIR__ . '/../../data/GitHubPingPayload.json');
$this->sendPayload(
- '/gate/GitHub/Quux',
+ '/gate/GitHub/Quux', // A gate not existing in data/credentials.json
$payload,
'POST',
[
diff --git a/tests/Http/PayloadFullTest.php b/tests/Http/PayloadFullTest.php
--- a/tests/Http/PayloadFullTest.php
+++ b/tests/Http/PayloadFullTest.php
@@ -1,6 +1,7 @@
<?php
namespace Nasqueron\Notifications\Tests;
+use Storage;
class PayloadFullTest extends TestCase {
@@ -16,20 +17,38 @@
public function testPost () {
$payload = file_get_contents(__DIR__ . '/../data/GitHubPingPayload.json');
$this->sendPayload(
- '/gate/GitHub/Quux',
+ '/gate/GitHub/Acme', // A gate existing in data/credentials.json
$payload,
'POST',
[
'X-Github-Event' => 'ping',
- 'X-Github-Delivery' => 'e5dd9fc7-17ac-11e5-9427-73dad6b9b17c'
+ 'X-Github-Delivery' => 'e5dd9fc7-17ac-11e5-9427-73dad6b9b17c',
+ 'X-Hub-Signature' => 'sha1=25f6cbd17ea4c6c69958b95fb88c879de4b66dcc',
]
- )
- ->seeJson([
+ )->seeJson([
'gate' => 'GitHub',
- 'door' => 'Quux',
+ 'door' => 'Acme',
'action' => 'AMQPAction'
]);
$this->assertResponseOk();
}
+
+ /**
+ * Tests a GitHub gate payload.
+ */
+ public function testInvalidSignature () {
+ $payload = file_get_contents(__DIR__ . '/../data/GitHubPingPayload.json');
+ $this->sendPayload(
+ '/gate/GitHub/Acme', // A gate existing in data/credentials.json
+ $payload,
+ 'POST',
+ [
+ 'X-Github-Event' => 'ping',
+ 'X-Github-Delivery' => 'e5dd9fc7-17ac-11e5-9427-73dad6b9b17c',
+ 'X-Hub-Signature' => 'sha1=somethingwrong',
+ ]
+ );
+ $this->assertResponseStatus(403);
+ }
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 8, 15:26 (1 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2337191
Default Alt Text
D213.diff (2 KB)
Attached To
Mode
D213: PayloadFullTest with secret verification
Attached
Detach File
Event Timeline
Log In to Comment