public function testRefreshTokenNoSubScope() { $h = new HttpRequest("https://auth.example.org/token", "POST"); $h->setBasicAuthUser("testcodeclient"); $h->setBasicAuthPass("abcdef"); $h->setPostParameters(array("refresh_token" => "r3fr3sh", "scope" => "we want no sub scope", "grant_type" => "refresh_token")); $t = new Token($this->_config, NULL); $response = $t->handleRequest($h); $this->assertEquals(200, $response->getStatusCode()); $this->assertRegexp('|^{"access_token":"[a-zA-Z0-9]+","expires_in":5,"scope":"read write foo","token_type":"bearer"}$|', $response->getContent()); }
public function testAuthentication() { $h = new HttpRequest("http://www.example.org", "GET"); $h->setBasicAuthUser("foo"); $h->setBasicAuthPass("bar"); $this->assertEquals("foo", $h->getBasicAuthUser()); $this->assertEquals("bar", $h->getBasicAuthPass()); }