Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import paramiko
- import SSH
- import unittest
- from test import support
- class SwitchAccount(unittest.TestCase):
- def setUp(self):
- self.s = testcore.control.ssh.SSH(host='xxx.xx.xx.xxx', username='admin', password='admin')
- if self.s.login():
- print('connection succesfull')
- else:
- print('connection negativ')
- self.s.query_interactive = True
- def test_change_Enforce_Enable(self):
- if self.s.login():
- q = self.s.query('account')
- # switch to prompt account
- q = self.s.query('enforce-Password-Rules yes')
- def test_create_user_rights_1(self):
- if self.s.login():
- q = self.s.query('account')
- # switch to prompt account
- q = self.s.query('add 1 testuser_P1 testuser_P1')
- q = self.s.query('logout')
- def setUp(self):
- self.s = testcore.control.ssh.SSH(host='xxx.xx.xx.xxx', username='testuser_P1', password='testuser_P1')
- if self.s.login():
- print('connection succesfull')
- else:
- print('connection negativ')
- import time
- print('Wait')
- time.sleep(6)
- def test_try_wrong_promp_command(self):
- if self.s.login():
- q = self.s.query('account')
- # switch to prompt account
- q = self.s.query('aaa')
- q = self.s.query('trace ')
- import time
- print('Wait')
- time.sleep(6)
- def test_create_user_rights_2(self):
- if self.s.login():
- q = self.s.query('account')
- # switch to prompt account
- q = self.s.query('add 2 testuser_P2 testuser_P2')
- import time
- print('Wait')
- time.sleep(6)
- q = self.s.query('logout')
- def setUp(self):
- self.s = testcore.control.ssh.SSH(host='xxx.xx.xx.xxx', username='testuser_P2', password='testuser_P2')
- if self.s.login():
- print('connection succesfull')
- else:
- print('connection negativ')
- def test_try_wrong_promp_command(self):
- if self.s.login():
- q = self.s.query('account')
- # switch to prompt account
- q = self.s.query('aaa')
- q = self.s.query('trace ')
- if __name__ == '__main__':
- unittest.main(verbosity=3)
- unittest.main(warnings='ig-nore')
- log_file = 'log_file.txt'
- f = open(log_file, "w")
- import Paramiko
- import SSH
- import unittest
- from test import support
- class SwitchAccount(unittest.TestCase):
- def setUp(self):
- self.s = testcore.control.ssh.SSH(host='xxx.xx.xx.xxx', username='admin', password='admin')
- if self.s.login():
- print('connection succesfull')
- else:
- print('connection negativ')
- self.s.query_interactive = True
- def test_create_user_rights_1(self):
- if self.s.login():
- q = self.s.query('account')
- # switch to prompt account
- q = self.s.query('add 1 testuser_P1 testuser_P1')
- q = self.s.query('logout')
- def setUp(self):
- self.s = testcore.control.ssh.SSH(host='xxx.xx.xx.xxx', username='testuser_P1', password='testuser_P1')
- if self.s.login():
- print('connection succesfull')
- else:
- print('connection negativ')
- import time
- print('Wait')
- time.sleep(6)
- def test_try_wrong_promp_command(self):
- if self.s.login():
- q = self.s.query('account')
- # switch to prompt account
- q = self.s.query('aaa')
- q = self.s.query('trace ')
- import time
- print('Wait')
- time.sleep(6)
- def test_create_user_rights_2(self):
- if self.s.login():
- q = self.s.query('account')
- # switch to prompt account
- q = self.s.query('add 2 testuser_P2 testuser_P2')
- import time
- print('Wait')
- time.sleep(6)
- q = self.s.query('logout')
- def setUp(self):
- self.s = testcore.control.ssh.SSH(host='xxx.xx.xx.xxx', username='testuser_P2', password='testuser_P2')
- if self.s.login():
- print('connection succesfull')
- else:
- print('connection negativ')
- def test_try_wrong_promp_command(self):
- if self.s.login():
- q = self.s.query('account')
- # switch to prompt account
- q = self.s.query('aaa')
- q = self.s.query('trace ')
Add Comment
Please, Sign In to add comment