コード例 #1
0
 def test_update_password(self):
     """
     The update_password() method runs a groovy script to update the
     password for the given user.
     """
     username = "******"
     password = "******"
     script = UPDATE_PASSWORD_SCRIPT.format(username=username,
                                            password=password)
     self.fakes.jenkins.scripts[script] = ""
     self.assertIsNone(self.api.update_password(username, password))
コード例 #2
0
ファイル: test_api.py プロジェクト: jenkinsci/jenkins-charm
 def test_update_password(self):
     """
     The update_password() method runs a groovy script to update the
     password for the given user.
     """
     username = "******"
     password = "******"
     script = UPDATE_PASSWORD_SCRIPT.format(
         username=username, password=password)
     self.fakes.jenkins.scripts[script] = ""
     self.assertIsNone(self.api.update_password(username, password))
コード例 #3
0
ファイル: test_users.py プロジェクト: sastix/jenkins-charm
    def test_configure_admin_random_password(self):
        """
        If a password is not provided, a random one will be generated.
        """
        def pwgen(length):
            return "z"
        script = UPDATE_PASSWORD_SCRIPT.format(username="******", password="******")
        self.fakes.jenkins.scripts[script] = ""

        self.useFixture(MonkeyPatch("charmhelpers.core.host.pwgen", pwgen))
        self.users.configure_admin()
        self.assertTrue(hookenv.config()["_generated-password"])
コード例 #4
0
ファイル: test_users.py プロジェクト: sastix/jenkins-charm
    def test_configure_admin_custom_password(self):
        """
        If a password is provided, it's used to configure the admin user.
        """
        self.fakes.juju.config["password"] = "******"
        script = UPDATE_PASSWORD_SCRIPT.format(username="******", password="******")
        self.fakes.jenkins.scripts[script] = ""

        self.users.configure_admin()

        self.assertThat(paths.ADMIN_PASSWORD, FileContains("x"))
        self.assertThat(paths.ADMIN_PASSWORD, HasOwnership(0, 0))
        self.assertThat(paths.ADMIN_PASSWORD, HasPermissions("0600"))

        self.assertThat(paths.LAST_EXEC, FileContains("2.0.0\n"))
        self.assertThat(paths.LAST_EXEC, HasOwnership(123, 456))