diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-12-05 20:31:27 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-12-05 20:31:27 -0500 |
commit | e9fedf3e5cd63aea4da7a71f6647ee427c62fa49 (patch) | |
tree | abc2de5aebace4a2d7c94805552264dab6b10bc7 /tests/units/Core/OAuth2Test.php | |
parent | 346b8312e5ac877ce3192c2db3a26b500018bbb5 (diff) |
Rewrite of the authentication and authorization system
Diffstat (limited to 'tests/units/Core/OAuth2Test.php')
-rw-r--r-- | tests/units/Core/OAuth2Test.php | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/tests/units/Core/OAuth2Test.php b/tests/units/Core/OAuth2Test.php deleted file mode 100644 index d5713608..00000000 --- a/tests/units/Core/OAuth2Test.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -require_once __DIR__.'/../Base.php'; - -use Kanboard\Core\OAuth2; - -class OAuth2Test extends Base -{ - public function testAuthUrl() - { - $oauth = new OAuth2($this->container); - $oauth->createService('A', 'B', 'C', 'D', 'E', array('f', 'g')); - $this->assertEquals('D?response_type=code&client_id=A&redirect_uri=C&scope=f+g', $oauth->getAuthorizationUrl()); - } - - public function testAuthHeader() - { - $oauth = new OAuth2($this->container); - $oauth->createService('A', 'B', 'C', 'D', 'E', array('f', 'g')); - - $oauth->setAccessToken('foobar', 'BeaRer'); - $this->assertEquals('Authorization: Bearer foobar', $oauth->getAuthorizationHeader()); - - $oauth->setAccessToken('foobar', 'unknown'); - $this->assertEquals('', $oauth->getAuthorizationHeader()); - } - - public function testAccessToken() - { - $oauth = new OAuth2($this->container); - $oauth->createService('A', 'B', 'C', 'D', 'E', array('f', 'g')); - $oauth->getAccessToken('something'); - - $data = $this->container['httpClient']->getData(); - $this->assertEquals('something', $data['code']); - $this->assertEquals('A', $data['client_id']); - $this->assertEquals('B', $data['client_secret']); - $this->assertEquals('C', $data['redirect_uri']); - $this->assertEquals('authorization_code', $data['grant_type']); - - $this->assertEquals('E', $this->container['httpClient']->getUrl()); - } -} |