Example #1
0
def test_equals(mocker):
    decrypted_pairs_mock = mocker.patch(
        'confidant.models.credential.Credential.decrypted_credential_pairs'
    )
    decrypted_pairs_mock.return_value = {'test': 'me'}
    cred1 = Credential(
        name='test',
        enabled=True,
        documentation='',
        metadata={},
    )
    cred2 = Credential(
        name='test',
        enabled=True,
        documentation='',
        metadata={},
    )
    assert cred1.equals(cred2) is True
Example #2
0
def test_not_equals_different_tags(mocker):
    decrypted_pairs_mock = mocker.patch(
        'confidant.models.credential.Credential.decrypted_credential_pairs')
    decrypted_pairs_mock.return_value = {'test': 'me'}
    cred1 = Credential(
        name='test',
        enabled=True,
        documentation='',
        metadata={},
        tags=['ADMIN_PRIV'],
    )
    cred2 = Credential(
        name='test',
        enabled=True,
        documentation='',
        metadata={},
        tags=['FINANCIALLY_SENSITIVE'],
    )
    assert cred1.equals(cred2) is False
Example #3
0
def test_not_equals(mocker):
    mocker.patch(
        'confidant.models.credential.Credential'
        '._get_decrypted_credential_pairs',
        return_value={'test': 'me'},
    )
    cred1 = Credential(
        name='test',
        enabled=True,
        documentation='',
        metadata={},
    )
    cred2 = Credential(
        name='test2',
        enabled=True,
        documentation='',
        metadata={},
    )
    assert cred1.equals(cred2) is False