Exemple #1
0
    def test_delete_credential(self):
        creds = self.jenkins.credentials

        cred_descr = random_string()
        cred_dict = {
            'description': cred_descr,
            'userName': '******',
            'password': '******'
        }
        creds[cred_descr] = UsernamePasswordCredential(cred_dict)

        del creds[cred_descr]
Exemple #2
0
def test_delete_credential(jenkins):
    creds = jenkins.credentials

    cred_descr = random_string()
    cred_dict = {
        'description': cred_descr,
        'userName': '******',
        'password': '******'
    }
    creds[cred_descr] = UsernamePasswordCredential(cred_dict)

    assert cred_descr in creds
    del creds[cred_descr]
    assert cred_descr not in creds
Exemple #3
0
def test_update_user_pass_credential(jenkins):
    creds = jenkins.credentials

    cred_descr = random_string()
    cred_dict = {
        'description': cred_descr,
        'userName': '******',
        'password': '******'
    }
    creds[cred_descr] = UsernamePasswordCredential(cred_dict)

    cred = creds[cred_descr]
    cred.userName = '******'
    cred.password = '******'

    with pytest.raises(JenkinsAPIException):
        creds[cred_descr] = cred
Exemple #4
0
    def test_create_user_pass_credential(self):
        creds = self.jenkins.credentials

        cred_descr = random_string()
        cred_dict = {
            'description': cred_descr,
            'userName': '******',
            'password': '******'
        }
        creds[cred_descr] = UsernamePasswordCredential(cred_dict)

        self.assertTrue(cred_descr in creds)
        cred = creds[cred_descr]
        self.assertIsInstance(cred, UsernamePasswordCredential)
        self.assertEquals(cred.password, None)
        self.assertEquals(cred.description, cred_descr)

        del creds[cred_descr]
Exemple #5
0
def test_create_user_pass_credential(jenkins):
    creds = jenkins.credentials

    cred_descr = random_string()
    cred_dict = {
        'description': cred_descr,
        'userName': '******',
        'password': '******'
    }
    creds[cred_descr] = UsernamePasswordCredential(cred_dict)

    assert cred_descr in creds

    cred = creds[cred_descr]
    assert isinstance(cred, UsernamePasswordCredential) is True
    assert cred.password is None
    assert cred.description == cred_descr

    del creds[cred_descr]
Exemple #6
0
def test_update_user_pass_credential(jenkins):
    creds = jenkins.credentials

    cred_descr = random_string()
    cred_dict = {
        'description': cred_descr,
        'userName': '******',
        'password': '******'
    }
    creds[cred_descr] = UsernamePasswordCredential(cred_dict)

    cred = creds[cred_descr]
    cred.userName = '******'
    cred.password = '******'

    cred = creds[cred_descr]
    assert isinstance(cred, UsernamePasswordCredential) is True
    assert cred.userName == 'anotheruser'
    assert cred.password == 'password2'