Skip to content

Commit e9f8707

Browse files
authored
Merge pull request KnpLabs#479 from acrobat/user-publickeys-remove-update
Updating a user public key is not allowed
2 parents 437b1bb + 88191f5 commit e9f8707

File tree

2 files changed

+0
-68
lines changed

2 files changed

+0
-68
lines changed

lib/Github/Api/CurrentUser/DeployKeys.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -57,27 +57,6 @@ public function create(array $params)
5757
return $this->post('/user/keys', $params);
5858
}
5959

60-
/**
61-
* Updates deploy key for the authenticated user.
62-
*
63-
* @link http://developer.github.com/v3/repos/keys/
64-
*
65-
* @param string $id
66-
* @param array $params
67-
*
68-
* @throws \Github\Exception\MissingArgumentException
69-
*
70-
* @return array
71-
*/
72-
public function update($id, array $params)
73-
{
74-
if (!isset($params['title'], $params['key'])) {
75-
throw new MissingArgumentException(array('title', 'key'));
76-
}
77-
78-
return $this->patch('/user/keys/'.rawurlencode($id), $params);
79-
}
80-
8160
/**
8261
* Removes deploy key for the authenticated user.
8362
*

test/Github/Tests/Api/CurrentUser/DeployKeysTest.php

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -83,53 +83,6 @@ public function shouldNotCreateKeyWithoutKeyParam()
8383
$api->create($data);
8484
}
8585

86-
/**
87-
* @test
88-
*/
89-
public function shouldUpdateKey()
90-
{
91-
$expectedValue = array('id' => '123', 'key' => 'ssh-rsa ...');
92-
$data = array('title' => 'my key', 'key' => 'ssh-rsa ...');
93-
94-
$api = $this->getApiMock();
95-
$api->expects($this->once())
96-
->method('patch')
97-
->with('/user/keys/123', $data)
98-
->will($this->returnValue($expectedValue));
99-
100-
$this->assertEquals($expectedValue, $api->update(123, $data));
101-
}
102-
103-
/**
104-
* @test
105-
* @expectedException \Github\Exception\MissingArgumentException
106-
*/
107-
public function shouldNotUpdateKeyWithoutTitleParam()
108-
{
109-
$data = array('key' => 'ssh-rsa ...');
110-
111-
$api = $this->getApiMock();
112-
$api->expects($this->never())
113-
->method('patch');
114-
115-
$api->update(123, $data);
116-
}
117-
118-
/**
119-
* @test
120-
* @expectedException \Github\Exception\MissingArgumentException
121-
*/
122-
public function shouldNotUpdateKeyWithoutKeyParam()
123-
{
124-
$data = array('title' => 'my key');
125-
126-
$api = $this->getApiMock();
127-
$api->expects($this->never())
128-
->method('patch');
129-
130-
$api->update(123, $data);
131-
}
132-
13386
/**
13487
* @test
13588
*/

0 commit comments

Comments
 (0)