def test_bootstrap(mocker):
    mocker.patch(
        'confidant.encrypted_settings.cryptolib.decrypt_datakey',
        return_value=b'1cVUbJT58SbMt4Wk4xmEZoNhZGdWO_vg1IJiXwc6HGs==',
    )
    mocker.patch(
        'confidant.encrypted_settings.Fernet.decrypt',
        return_value='{secret: value, secret2: value2}\n',
    )
    enc_set = EncryptedSettings(None)
    decrypted = enc_set._bootstrap(
        '{"secrets": "encryptedstring", "data_key": "dGhla2V5"}')
    assert decrypted['secret2'] == 'value2'
 def test_bootstrap_filefail(self):
     enc_set = EncryptedSettings(None)
     decrypted = enc_set._bootstrap('file://FILE/DOES/NOT/EXIST')
     self.assertEqual(decrypted, {})
 def test_bootstrap(self, mockdecryptkey, mockdecrypt):
     enc_set = EncryptedSettings(None)
     decrypted = enc_set._bootstrap(
         '{"secrets": "encryptedstring", "data_key": "dGhla2V5"}')
     self.assertEqual(decrypted['secret2'], 'value2')
def test_bootstrap_filefail():
    enc_set = EncryptedSettings(None)
    decrypted = enc_set._bootstrap('file://FILE/DOES/NOT/EXIST')
    assert decrypted == {}