Page MenuHomeDevCentral

No OneTemporary

diff --git a/tests/Http/Controllers/GitHubGateControllerTest.php b/tests/Http/Controllers/GitHubGateControllerTest.php
index f1717e5..d13b5a7 100644
--- a/tests/Http/Controllers/GitHubGateControllerTest.php
+++ b/tests/Http/Controllers/GitHubGateControllerTest.php
@@ -1,46 +1,46 @@
<?php
namespace Nasqueron\Notifications\Tests\Http\Controllers;
use Nasqueron\Notifications\Tests\TestCase;
class GitHubGateControllerTest extends TestCase {
public function setUp () {
parent::setUp();
$this->disableEvents();
}
/**
* GitHub gate works.
*
* @return void
*/
public function testGet () {
$this->visit('/gate/GitHub')
->see('POST');
}
/**
* Tests a GitHub gate payload.
*/
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',
[
'X-Github-Event' => 'ping',
'X-Github-Delivery' => 'e5dd9fc7-17ac-11e5-9427-73dad6b9b17c'
]
)
->seeJson([
'gate' => 'GitHub',
'door' => 'Quux',
'actions' => []
]);
$this->assertResponseOk();
}
}
diff --git a/tests/Http/PayloadFullTest.php b/tests/Http/PayloadFullTest.php
index 141972c..5e129e0 100644
--- a/tests/Http/PayloadFullTest.php
+++ b/tests/Http/PayloadFullTest.php
@@ -1,35 +1,54 @@
<?php
namespace Nasqueron\Notifications\Tests;
+use Storage;
class PayloadFullTest extends TestCase {
public function setUp () {
parent::setUp();
$this->disableBroker();
}
/**
* Tests a GitHub gate payload.
*/
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

Mime Type
text/x-diff
Expires
Sat, Mar 7, 01:29 (1 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3500256
Default Alt Text
(3 KB)

Event Timeline