From 88191f5a550d3341e7215be63998a4713b68b022 Mon Sep 17 00:00:00 2001 From: Jeroen Thora Date: Sun, 4 Dec 2016 15:43:59 +0100 Subject: [PATCH] Updating a user public key is not allowed --- lib/Github/Api/CurrentUser/DeployKeys.php | 21 --------- .../Tests/Api/CurrentUser/DeployKeysTest.php | 47 ------------------- 2 files changed, 68 deletions(-) diff --git a/lib/Github/Api/CurrentUser/DeployKeys.php b/lib/Github/Api/CurrentUser/DeployKeys.php index dc8df79941f..fb64ba73ff1 100644 --- a/lib/Github/Api/CurrentUser/DeployKeys.php +++ b/lib/Github/Api/CurrentUser/DeployKeys.php @@ -57,27 +57,6 @@ public function create(array $params) return $this->post('/user/keys', $params); } - /** - * Updates deploy key for the authenticated user. - * - * @link http://developer.github.com/v3/repos/keys/ - * - * @param string $id - * @param array $params - * - * @throws \Github\Exception\MissingArgumentException - * - * @return array - */ - public function update($id, array $params) - { - if (!isset($params['title'], $params['key'])) { - throw new MissingArgumentException(array('title', 'key')); - } - - return $this->patch('/user/keys/'.rawurlencode($id), $params); - } - /** * Removes deploy key for the authenticated user. * diff --git a/test/Github/Tests/Api/CurrentUser/DeployKeysTest.php b/test/Github/Tests/Api/CurrentUser/DeployKeysTest.php index edbd58991f9..33149397193 100644 --- a/test/Github/Tests/Api/CurrentUser/DeployKeysTest.php +++ b/test/Github/Tests/Api/CurrentUser/DeployKeysTest.php @@ -83,53 +83,6 @@ public function shouldNotCreateKeyWithoutKeyParam() $api->create($data); } - /** - * @test - */ - public function shouldUpdateKey() - { - $expectedValue = array('id' => '123', 'key' => 'ssh-rsa ...'); - $data = array('title' => 'my key', 'key' => 'ssh-rsa ...'); - - $api = $this->getApiMock(); - $api->expects($this->once()) - ->method('patch') - ->with('/user/keys/123', $data) - ->will($this->returnValue($expectedValue)); - - $this->assertEquals($expectedValue, $api->update(123, $data)); - } - - /** - * @test - * @expectedException \Github\Exception\MissingArgumentException - */ - public function shouldNotUpdateKeyWithoutTitleParam() - { - $data = array('key' => 'ssh-rsa ...'); - - $api = $this->getApiMock(); - $api->expects($this->never()) - ->method('patch'); - - $api->update(123, $data); - } - - /** - * @test - * @expectedException \Github\Exception\MissingArgumentException - */ - public function shouldNotUpdateKeyWithoutKeyParam() - { - $data = array('title' => 'my key'); - - $api = $this->getApiMock(); - $api->expects($this->never()) - ->method('patch'); - - $api->update(123, $data); - } - /** * @test */