feat: add saved SSH keys and terminal workspace tools
This commit is contained in:
+41
-3
@@ -852,6 +852,44 @@ class TestAppWithUnknownEncoding(OtherTestBase):
|
||||
|
||||
class TestAppWithSavedConnections(OtherTestBase):
|
||||
|
||||
def test_connection_form_exposes_separate_credential_controls(self):
|
||||
response = self.fetch('/')
|
||||
self.assertIn(b'name="save_credentials" value="1">', response.body)
|
||||
self.assertIn(b'name="save_passphrase" value="1">', response.body)
|
||||
self.assertIn(b'id="privatekey-hint"', response.body)
|
||||
|
||||
@tornado.testing.gen_test
|
||||
def test_saved_key_can_connect_without_uploading_again(self):
|
||||
privatekey = read_file(make_tests_data_path('user_rsa_key'))
|
||||
body = dict(self.body, password='', privatekey=privatekey,
|
||||
save='1', save_credentials='1')
|
||||
response = yield self.async_post('/', body)
|
||||
data = json.loads(to_str(response.body))
|
||||
self.assert_status_none(data)
|
||||
self.assertTrue(data['profile']['has_privatekey'])
|
||||
self.assertNotIn('privatekey_enc', data['profile'])
|
||||
response = yield self.async_get('/connections')
|
||||
self.assertNotIn(b'privatekey_enc', response.body)
|
||||
self.assertNotIn(to_str(privatekey).encode('utf-8'), response.body)
|
||||
response = yield self.async_post('/', dict(self.body, password=''))
|
||||
self.assert_status_none(json.loads(to_str(response.body)))
|
||||
response = yield self.async_post(
|
||||
'/', dict(self.body, password='', username='bar')
|
||||
)
|
||||
self.assert_status_equal(
|
||||
'Authentication failed.', json.loads(to_str(response.body))
|
||||
)
|
||||
|
||||
@tornado.testing.gen_test
|
||||
def test_save_without_credentials_clears_saved_password(self):
|
||||
body = dict(self.body, save='1', save_credentials='1')
|
||||
response = yield self.async_post('/', body)
|
||||
self.assert_status_none(json.loads(to_str(response.body)))
|
||||
response = yield self.async_post('/', dict(self.body, save='1'))
|
||||
data = json.loads(to_str(response.body))
|
||||
self.assert_status_none(data)
|
||||
self.assertFalse(data['profile']['has_password'])
|
||||
|
||||
def async_get(self, path):
|
||||
return self.get_http_client().fetch(
|
||||
self.get_url(path), headers=self.headers
|
||||
@@ -859,7 +897,7 @@ class TestAppWithSavedConnections(OtherTestBase):
|
||||
|
||||
@tornado.testing.gen_test
|
||||
def test_saved_password_never_reaches_the_browser(self):
|
||||
body = dict(self.body, save='1')
|
||||
body = dict(self.body, save='1', save_credentials='1')
|
||||
response = yield self.async_post('/', body)
|
||||
data = json.loads(to_str(response.body))
|
||||
self.assert_status_none(data)
|
||||
@@ -880,7 +918,7 @@ class TestAppWithSavedConnections(OtherTestBase):
|
||||
|
||||
@tornado.testing.gen_test
|
||||
def test_saved_password_is_reused_when_the_field_is_left_empty(self):
|
||||
body = dict(self.body, save='1')
|
||||
body = dict(self.body, save='1', save_credentials='1')
|
||||
response = yield self.async_post('/', body)
|
||||
self.assert_status_none(json.loads(to_str(response.body)))
|
||||
|
||||
@@ -891,7 +929,7 @@ class TestAppWithSavedConnections(OtherTestBase):
|
||||
|
||||
@tornado.testing.gen_test
|
||||
def test_saved_password_is_not_sent_to_another_destination(self):
|
||||
body = dict(self.body, save='1')
|
||||
body = dict(self.body, save='1', save_credentials='1')
|
||||
response = yield self.async_post('/', body)
|
||||
self.assert_status_none(json.loads(to_str(response.body)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user