def test_positive_CRD_ssh_key(self, module_user): """SSH Key can be added to a User, listed and deletd :id: 57304fca-8e0d-454a-be31-34423345c8b2 :expectedresults: SSH key should be added to new user, listed and deleted :CaseImportance: Critical """ ssh_name = gen_string('alpha') User.ssh_keys_add({ 'user': module_user.login, 'key': self.ssh_key, 'name': ssh_name }) result = User.ssh_keys_list({'user-id': module_user.id}) assert ssh_name in [i['name'] for i in result] result = User.ssh_keys_info({ 'user-id': module_user.id, 'name': ssh_name }) assert self.ssh_key in result[0]['public-key'] result = User.ssh_keys_delete({ 'user-id': module_user.id, 'name': ssh_name }) result = User.ssh_keys_list({'user-id': module_user.id}) assert ssh_name not in [i['name'] for i in result]
def test_positive_CRD_ssh_key(self): """SSH Key can be added to a User, listed and deletd :id: 57304fca-8e0d-454a-be31-34423345c8b2 :expectedresults: SSH key should be added to new user, listed and deleted :CaseImportance: Critical """ ssh_name = gen_string('alpha') ssh_key = self.gen_ssh_rsakey() User.ssh_keys_add({ 'user': self.user.login, 'key': ssh_key, 'name': ssh_name }) result = User.ssh_keys_list({'user-id': self.user.id}) self.assertIn(ssh_name, [i['name'] for i in result]) result = User.ssh_keys_info({ 'user-id': self.user.id, 'name': ssh_name }) self.assertEqual(ssh_key, result[0]['public-key']) result = User.ssh_keys_delete({ 'user-id': self.user.id, 'name': ssh_name }) result = User.ssh_keys_list({'user-id': self.user.id}) self.assertNotIn(ssh_name, [i['name'] for i in result])
def test_positive_create_ssh_key_super_admin_from_file(self): """SSH Key can be added to Super Admin user from file :id: b865d0ae-6317-475c-a6da-600615b71eeb :expectedresults: SSH Key should be added to Super Admin user from ssh pub file :CaseImportance: Critical """ ssh_name = gen_string('alpha') ssh_key = self.gen_ssh_rsakey() with get_connection() as connection: result = connection.run( '''echo '{}' > test_key.pub'''.format(ssh_key)) self.assertEqual(result.return_code, 0, 'key file not created') User.ssh_keys_add({ 'user': '******', 'key-file': 'test_key.pub', 'name': ssh_name }) result = User.ssh_keys_list({'user': '******'}) self.assertIn(ssh_name, [i['name'] for i in result]) result = User.ssh_keys_info({'user': '******', 'name': ssh_name}) self.assertEqual(ssh_key, result[0]['public-key'])
def test_positive_create_ssh_key_super_admin_from_file(self, default_sat): """SSH Key can be added to Super Admin user from file :id: b865d0ae-6317-475c-a6da-600615b71eeb :expectedresults: SSH Key should be added to Super Admin user from ssh pub file :CaseImportance: Critical """ ssh_name = gen_string('alpha') result = default_sat.execute(f"echo '{self.ssh_key}' > test_key.pub") assert result.status == 0, 'key file not created' User.ssh_keys_add({'user': '******', 'key-file': 'test_key.pub', 'name': ssh_name}) result = User.ssh_keys_list({'user': '******'}) assert ssh_name in [i['name'] for i in result] result = User.ssh_keys_info({'user': '******', 'name': ssh_name}) assert self.ssh_key == result[0]['public-key']
def test_positive_create_ssh_key_super_admin_from_file(self, ssh_key): """SSH Key can be added to Super Admin user from file :id: b865d0ae-6317-475c-a6da-600615b71eeb :expectedresults: SSH Key should be added to Super Admin user from ssh pub file :CaseImportance: Critical """ ssh_name = gen_string('alpha') with get_connection() as connection: result = connection.run(f'''echo '{ssh_key}' > test_key.pub''') assert result.return_code == 0, 'key file not created' User.ssh_keys_add({'user': '******', 'key-file': 'test_key.pub', 'name': ssh_name}) result = User.ssh_keys_list({'user': '******'}) assert ssh_name in [i['name'] for i in result] result = User.ssh_keys_info({'user': '******', 'name': ssh_name}) assert ssh_key == result[0]['public-key']