File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,3 +41,9 @@ class SSHKey(Object, metaclass=SSHKeyType):
4141 id = ObjectField .Checked ("id" , check (int ), readonly = True )
4242 key = ObjectField .Checked ("key" , check (str ), readonly = True )
4343 keysource = ObjectField .Checked ("keysource" , check_optional (str ), readonly = True )
44+
45+ async def delete (self ):
46+ """Delete this key."""
47+ await self ._handler .delete (
48+ id = self .id ,
49+ )
Original file line number Diff line number Diff line change @@ -48,3 +48,13 @@ def test__sshkey_read(self):
4848 key_dict = {"id" : key_id , "key" : make_string_without_spaces (), "keysource" : "" }
4949 SSHKey ._handler .read .return_value = key_dict
5050 self .assertThat (SSHKey .read (id = key_id ), Equals (SSHKey (key_dict )))
51+
52+ def test__sshkey_delete (self ):
53+ """SSHKeys.read() returns a single SSH key."""
54+ SSHKey = make_origin ().SSHKey
55+ key_id = random .randint (0 , 100 )
56+ ssh_key = SSHKey (
57+ {"id" : key_id , "key" : make_string_without_spaces (), "keysource" : "" }
58+ )
59+ ssh_key .delete ()
60+ SSHKey ._handler .delete .assert_called_once_with (id = key_id )
You can’t perform that action at this time.
0 commit comments