mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
fix pylint error
This commit is contained in:
parent
4c1ab082b6
commit
d115878714
@ -1,4 +1,7 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
'''
|
||||||
|
Integration Tests for restcherry salt-api with pam eauth
|
||||||
|
'''
|
||||||
|
|
||||||
# Import python libs
|
# Import python libs
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
@ -31,7 +34,7 @@ USERA = 'saltdev'
|
|||||||
USERA_PWD = 'saltdev'
|
USERA_PWD = 'saltdev'
|
||||||
SET_USERA_PWD = '$6$SALTsalt$ZZFD90fKFWq8AGmmX0L3uBtS9fXL62SrTk5zcnQ6EkD6zoiM3kB88G1Zvs0xm/gZ7WXJRs5nsTBybUvGSqZkT.'
|
SET_USERA_PWD = '$6$SALTsalt$ZZFD90fKFWq8AGmmX0L3uBtS9fXL62SrTk5zcnQ6EkD6zoiM3kB88G1Zvs0xm/gZ7WXJRs5nsTBybUvGSqZkT.'
|
||||||
|
|
||||||
auth_creds = {
|
AUTH_CREDS = {
|
||||||
'username': USERA,
|
'username': USERA,
|
||||||
'password': USERA_PWD,
|
'password': USERA_PWD,
|
||||||
'eauth': 'pam'}
|
'eauth': 'pam'}
|
||||||
@ -48,7 +51,8 @@ class TestAuthPAM(BaseRestCherryPyTest, integration.ModuleCase):
|
|||||||
super(TestAuthPAM, self).setUp()
|
super(TestAuthPAM, self).setUp()
|
||||||
try:
|
try:
|
||||||
add_user = self.run_function('user.add', [USERA], createhome=False)
|
add_user = self.run_function('user.add', [USERA], createhome=False)
|
||||||
add_pwd = self.run_function('shadow.set_password', [USERA, SET_USERA_PWD])
|
add_pwd = self.run_function('shadow.set_password',
|
||||||
|
[USERA, SET_USERA_PWD])
|
||||||
self.assertTrue(add_user)
|
self.assertTrue(add_user)
|
||||||
self.assertTrue(add_pwd)
|
self.assertTrue(add_pwd)
|
||||||
user_list = self.run_function('user.list_users')
|
user_list = self.run_function('user.list_users')
|
||||||
@ -65,7 +69,7 @@ class TestAuthPAM(BaseRestCherryPyTest, integration.ModuleCase):
|
|||||||
This test ensures this PR is working correctly:
|
This test ensures this PR is working correctly:
|
||||||
https://github.com/saltstack/salt/pull/31826
|
https://github.com/saltstack/salt/pull/31826
|
||||||
'''
|
'''
|
||||||
copyauth_creds = auth_creds.copy()
|
copyauth_creds = AUTH_CREDS.copy()
|
||||||
copyauth_creds['service'] = 'chsh'
|
copyauth_creds['service'] = 'chsh'
|
||||||
copyauth_creds['password'] = 'wrong_password'
|
copyauth_creds['password'] = 'wrong_password'
|
||||||
body = urlencode(copyauth_creds)
|
body = urlencode(copyauth_creds)
|
||||||
@ -81,7 +85,7 @@ class TestAuthPAM(BaseRestCherryPyTest, integration.ModuleCase):
|
|||||||
This test ensures this PR is working correctly:
|
This test ensures this PR is working correctly:
|
||||||
https://github.com/saltstack/salt/pull/31826
|
https://github.com/saltstack/salt/pull/31826
|
||||||
'''
|
'''
|
||||||
copyauth_creds = auth_creds.copy()
|
copyauth_creds = AUTH_CREDS.copy()
|
||||||
copyauth_creds['service'] = 'login'
|
copyauth_creds['service'] = 'login'
|
||||||
copyauth_creds['password'] = 'wrong_password'
|
copyauth_creds['password'] = 'wrong_password'
|
||||||
body = urlencode(copyauth_creds)
|
body = urlencode(copyauth_creds)
|
||||||
@ -97,7 +101,7 @@ class TestAuthPAM(BaseRestCherryPyTest, integration.ModuleCase):
|
|||||||
This test ensures this PR is working correctly:
|
This test ensures this PR is working correctly:
|
||||||
https://github.com/saltstack/salt/pull/31826
|
https://github.com/saltstack/salt/pull/31826
|
||||||
'''
|
'''
|
||||||
copyauth_creds = auth_creds.copy()
|
copyauth_creds = AUTH_CREDS.copy()
|
||||||
copyauth_creds['service'] = 'chsh'
|
copyauth_creds['service'] = 'chsh'
|
||||||
body = urlencode(copyauth_creds)
|
body = urlencode(copyauth_creds)
|
||||||
request, response = self.request('/login', method='POST', body=body,
|
request, response = self.request('/login', method='POST', body=body,
|
||||||
@ -112,7 +116,7 @@ class TestAuthPAM(BaseRestCherryPyTest, integration.ModuleCase):
|
|||||||
This test ensures this PR is working correctly:
|
This test ensures this PR is working correctly:
|
||||||
https://github.com/saltstack/salt/pull/31826
|
https://github.com/saltstack/salt/pull/31826
|
||||||
'''
|
'''
|
||||||
copyauth_creds = auth_creds.copy()
|
copyauth_creds = AUTH_CREDS.copy()
|
||||||
copyauth_creds['service'] = 'login'
|
copyauth_creds['service'] = 'login'
|
||||||
body = urlencode(copyauth_creds)
|
body = urlencode(copyauth_creds)
|
||||||
request, response = self.request('/login', method='POST', body=body,
|
request, response = self.request('/login', method='POST', body=body,
|
||||||
@ -123,7 +127,7 @@ class TestAuthPAM(BaseRestCherryPyTest, integration.ModuleCase):
|
|||||||
|
|
||||||
@destructiveTest
|
@destructiveTest
|
||||||
@skipIf(os.geteuid() != 0, 'You must be logged in as root to run this test')
|
@skipIf(os.geteuid() != 0, 'You must be logged in as root to run this test')
|
||||||
def tearDown(self, grains=None):
|
def tearDown(self):
|
||||||
'''
|
'''
|
||||||
Clean up after tests. Delete user
|
Clean up after tests. Delete user
|
||||||
'''
|
'''
|
||||||
|
Loading…
Reference in New Issue
Block a user