diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test_initial.py b/tests/unit/test_initial.py similarity index 58% rename from test_initial.py rename to tests/unit/test_initial.py index 298d30c..fc79b8b 100644 --- a/test_initial.py +++ b/tests/unit/test_initial.py @@ -15,28 +15,28 @@ def test_trailing_slash(): ## recursive_path_builder -@mock.patch('kv_recursive.list_path') -def test_recursive_path_buider(mock_list_path): - client = "" - kv_list = ['test/', 'test1'] - kv_version = 1 - source_mount = 'secret' - - mock_list_path.return_value = '' - - kv_recursive.recursive_path_builder(client, kv_list, kv_version, source_mount) - - assert kv_recursive.list_path.called - # assert kv_recursive.recursive_path_builder.called - - -@mock.patch('hvac.api.secrets_engines.kv_v1.list_secrets') -def test_list_path(mock_kv) - -kv_version = 1 -list_path() - - +#@mock.patch('kv_recursive.list_path') +#def test_recursive_path_buider(mock_list_path): +# client = "" +# kv_list = ['test/', 'test1'] +# kv_version = 1 +# source_mount = 'secret' +# +# mock_list_path.return_value = '' +# +# kv_recursive.recursive_path_builder(client, kv_list, kv_version, source_mount) +# +# assert kv_recursive.list_path.called +# # assert kv_recursive.recursive_path_builder.called + + +#@mock.patch('hvac.api.secrets_engines.kv_v1.list_secrets') +#def test_list_path(mock_kv) +# +#kv_version = 1 +#list_path() +# +# # kv_list has test/, ensure list_path is called then ensure recursive_path_builder is called # kv_list has no ending /s, ensure neither list_path or recursive_ are called @@ -47,4 +47,4 @@ def test_list_path(mock_kv) ## read_secrets_from_list -# pass a list with secret/test, mock return to read_secret() and enssure properformat of output \ No newline at end of file +# pass a list with secret/test, mock return to read_secret() and enssure properformat of output diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..3fc66c4 --- /dev/null +++ b/tox.ini @@ -0,0 +1,42 @@ +[flake8] +# Ignores +# E121: Line continuation not a multiple of 4 +# E128: Line continuation not lined up +# E402: Imports can be spaced out +# W503: Making if's readable +ignore = E121,E128,E402,W503,E12 + +# This project follows the datanav convention for line length. +max-complexity = 10 +max-line-length = 120 + +[tox] +# This means you MUST call pip install -e in your commands for each testenv +# unless you don't actually need the full env (e.g. flake8) +skipsdist = True +envlist = flake8, vault_kv_migration_tests + +[testenv] +basepython = python3.6 +basedeps = + pytest-cov + mock + pytest +whitelist_externals = + rm + +[testenv:flake8] +deps = + flake8 +commands = + flake8 ./tests/unit + +[testenv:vault_kv_migration_tests] +# changedir happens after deps so you need +# full path to reqs +deps = -r ./requirements.txt + {[testenv]basedeps} +commands = + pip install -e . + coverage erase + py.test --cov-report=term-missing ./tests/unit