def test_disable_requiretty_on_sshd_config_raises_exception_on_failure( self, *args, **kwargs): # this will make if fail sudo('rm /etc/ssh/sshd_config') with self.assertRaises(SystemExit) as cm: os_helpers.disable_requiretty_on_sshd_config() self.assertEqual(cm.exception.code, 1)
def test_disable_requiretty_on_sshd_config_raises_exception_on_failure( self, *args, **kwargs): # this will make if fail sudo('rm /etc/ssh/sshd_config') with self.assertRaises(SystemExit) as cm: os_helpers.disable_requiretty_on_sshd_config() self.assertEqual(cm.exception.code, 1)
def test_disable_requiretty_on_sshd_config_updates_sshd_config( self, *args, **kwargs): # distros have different /etc/sshd_config file contents, so we will make # sure we target the correct contents for each linux distribution. os = sudo('cat /etc/os-release').lower() # this is missing on our docker images sudo('echo "Requiretty yes" >> /etc/ssh/sshd_config') # update /etc/sshd_config os_helpers.disable_requiretty_on_sshd_config() # we rely on md5sum of the file so check if our changes were applied # correctly md5sum = sudo('md5sum /etc/ssh/sshd_config').split(' ')[0] if 'ubuntu' in os: self.assertEquals(md5sum, '208abf29a29805dbfe4ac954bb50b0c9') if 'centos' in os: self.assertEquals(md5sum, '9af1ec6efaf3bf271fc1838613fa0778')
def test_disable_requiretty_on_sshd_config_updates_sshd_config(self, *args, **kwargs): # distros have different /etc/sshd_config file contents, so we will make # sure we target the correct contents for each linux distribution. os = sudo('cat /etc/os-release').lower() # this is missing on our docker images sudo('echo "Requiretty yes" >> /etc/ssh/sshd_config') # update /etc/sshd_config os_helpers.disable_requiretty_on_sshd_config() # we rely on md5sum of the file so check if our changes were applied # correctly md5sum = sudo('md5sum /etc/ssh/sshd_config').split(' ')[0] if 'ubuntu' in os: self.assertEquals(md5sum, '208abf29a29805dbfe4ac954bb50b0c9') if 'centos' in os: self.assertEquals(md5sum, '9af1ec6efaf3bf271fc1838613fa0778')
def test_disable_requiretty_on_sshd_config_returns_True( self, *args, **kwargs): self.assertTrue(os_helpers.disable_requiretty_on_sshd_config())
def test_disable_requiretty_on_sshd_config_returns_True(self, *args, **kwargs): self.assertTrue(os_helpers.disable_requiretty_on_sshd_config())