Merge pull request #6102 from ryanpetrello/vault_migration

properly migrate vault credentials to the new credentialtype model
This commit is contained in:
Ryan Petrello
2017-04-25 15:35:16 -04:00
committed by GitHub
3 changed files with 61 additions and 44 deletions

View File

@@ -1,6 +1,7 @@
import mock
import pytest
from contextlib import contextmanager
from copy import deepcopy
from django.apps import apps
@@ -17,7 +18,7 @@ EXAMPLE_PRIVATE_KEY = '-----BEGIN PRIVATE KEY-----\nxyz==\n-----END PRIVATE KEY-
def migrate(credential, kind):
with mock.patch.object(Credential, 'kind', kind), \
mock.patch.object(Credential, 'objects', mock.Mock(
get=lambda **kw: credential,
get=lambda **kw: deepcopy(credential),
all=lambda: [credential]
)):
class Apps(apps.__class__):