コード例 #1
0
 def test_disable_env_reset_on_sudo_raises_exception_on_failure(
         self, *args, **kwargs):
     # this will make if fail
     sudo('rm /etc/sudoers')
     with self.assertRaises(SystemExit) as cm:
         os_helpers.disable_env_reset_on_sudo()
     self.assertEqual(cm.exception.code, 1)
コード例 #2
0
ファイル: test_os.py プロジェクト: ClusterHQ/bookshelf
 def test_disable_env_reset_on_sudo_raises_exception_on_failure(self,
                                                                *args,
                                                                **kwargs):
     # this will make if fail
     sudo('rm /etc/sudoers')
     with self.assertRaises(SystemExit) as cm:
         os_helpers.disable_env_reset_on_sudo()
     self.assertEqual(cm.exception.code, 1)
コード例 #3
0
    def test_disable_env_reset_on_sudo_updates_sudoers(self, *args, **kwargs):
        # distros have different /etc/sudoers file contents, so we will make
        # sure we target the correct contents for each linux distribution.
        os = sudo('cat /etc/os-release').lower()

        # update /etc/sudoers
        os_helpers.disable_env_reset_on_sudo()

        # we rely on md5sum of the file so check if our changes were applied
        # correctly
        md5sum = sudo('md5sum /etc/sudoers').split(' ')[0]
        if 'ubuntu' in os:
            self.assertEquals(md5sum, '5328c9fb99ad099d2d18a45bc67ee024')
        if 'centos' in os:
            sudo('md5sum /etc/sudoers')
            self.assertEquals(md5sum, '8d7a8d9630ccb427c5adbeccf6846415')
コード例 #4
0
ファイル: test_os.py プロジェクト: ClusterHQ/bookshelf
    def test_disable_env_reset_on_sudo_updates_sudoers(self, *args, **kwargs):
        # distros have different /etc/sudoers file contents, so we will make
        # sure we target the correct contents for each linux distribution.
        os = sudo('cat /etc/os-release').lower()

        # update /etc/sudoers
        os_helpers.disable_env_reset_on_sudo()

        # we rely on md5sum of the file so check if our changes were applied
        # correctly
        md5sum = sudo('md5sum /etc/sudoers').split(' ')[0]
        if 'ubuntu' in os:
            self.assertEquals(md5sum,
                              '5328c9fb99ad099d2d18a45bc67ee024')
        if 'centos' in os:
            sudo('md5sum /etc/sudoers')
            self.assertEquals(md5sum,
                              '8d7a8d9630ccb427c5adbeccf6846415')
コード例 #5
0
 def test_disable_env_reset_returns_True(self, *args, **kwargs):
     self.assertTrue(os_helpers.disable_env_reset_on_sudo())
コード例 #6
0
ファイル: test_os.py プロジェクト: ClusterHQ/bookshelf
 def test_disable_env_reset_returns_True(self, *args, **kwargs):
     self.assertTrue(os_helpers.disable_env_reset_on_sudo())