mirror of
https://github.com/bvanroll/python-vault-db.git
synced 2025-08-29 12:02:41 +00:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
9c4581cb72 | |||
fbf0277dd1 | |||
493d13f779 | |||
577d112b89 | |||
3cf1fa2dbd | |||
f960d43543 | |||
35f3e33cfd | |||
afd725d5b4 | |||
b2c7772ca1 |
3
.github/workflows/python-publish.yml
vendored
3
.github/workflows/python-publish.yml
vendored
@@ -22,6 +22,9 @@ jobs:
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install setuptools wheel twine
|
||||
- name: Test #TODO use a testing solution that won't be deprecated soon
|
||||
run: |
|
||||
python setup.py test
|
||||
- name: Build and publish
|
||||
env:
|
||||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
|
||||
|
21
.github/workflows/python-test.yml
vendored
Normal file
21
.github/workflows/python-test.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
name: Unit test runner
|
||||
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install setuptools wheel twine
|
||||
- name: Test #TODO use a testing solution that won't be deprecated soon
|
||||
run: |
|
||||
python setup.py test
|
||||
|
5
setup.py
5
setup.py
@@ -4,9 +4,10 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
setuptools.setup(
|
||||
name="VaultDb", # Replace with your own username
|
||||
name="vaultdb",
|
||||
version="0.0.1",
|
||||
version_config=True,
|
||||
test_suite="test",
|
||||
setup_requires=['setuptools-git-versioning'],
|
||||
author="Beppe Vanrolleghem",
|
||||
author_email="beppe.vanrolleghem@gmail.com",
|
||||
@@ -22,7 +23,7 @@ setuptools.setup(
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Operating System :: OS Independent",
|
||||
],
|
||||
package_dir={"": "vaultdatabaseengine"},
|
||||
package_dir={"": "src"},
|
||||
packages=setuptools.find_packages(where="src"),
|
||||
python_requires=">=3.6",
|
||||
)
|
||||
|
7
test/__init__.py
Normal file
7
test/__init__.py
Normal file
@@ -0,0 +1,7 @@
|
||||
import unittest
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
@@ -1,36 +0,0 @@
|
||||
import unittest
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
import vaultdatabaseengine
|
||||
|
||||
class MyTestCase(unittest.TestCase):
|
||||
def test_psql(self):
|
||||
#TODO exec psql connect
|
||||
print("hi")
|
||||
test = vaultdatabaseengine.Database()
|
||||
test.check_valid()
|
||||
self.assertEqual(test.valid, False)
|
||||
|
||||
def test_psql_invalid_vault_url(self):
|
||||
#TODO figure out how to fail unit test check
|
||||
try:
|
||||
vaultdatabaseengine.Database(dbname="sdfk", vault_url="localhost", vault_port=8200, token="bla")
|
||||
except:
|
||||
print("did it")
|
||||
return
|
||||
|
||||
def test_psql_invalid_vault_port(self):
|
||||
try:
|
||||
vaultdatabaseengine.Database(dbname="sdfk", vault_url="localhost", vault_port="a", token="bla")
|
||||
except:
|
||||
return
|
||||
|
||||
def test_psql_valid(self):
|
||||
print(vaultdatabaseengine.Database(dbname="psql", vault_url="http://localhost", token="s.GoR2nisHPeKU1vOaw9hZ5L7h").get_creds())
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
51
test/test_database.py
Normal file
51
test/test_database.py
Normal file
@@ -0,0 +1,51 @@
|
||||
import unittest
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
import src
|
||||
|
||||
class DatabaseClassTests(unittest.TestCase):
|
||||
|
||||
def test_vault_connection_error(self):
|
||||
#TODO give some "valid" url
|
||||
self.fail()
|
||||
|
||||
def test_vault_non_existent_database(self):
|
||||
#TODO test non existent_database
|
||||
self.fail()
|
||||
|
||||
def test_psql_connection(self):
|
||||
#TODO exec psql connect
|
||||
print("hi")
|
||||
test = src.Database()
|
||||
test.check_valid()
|
||||
self.assertEqual(test.valid, False)
|
||||
|
||||
def test_psql_invalid_vault_url(self):
|
||||
try:
|
||||
src.Database(dbname="sdfk", vault_url="localhost", vault_port=8200, token="bla")
|
||||
except:
|
||||
#TODO check the err msg
|
||||
return
|
||||
else:
|
||||
self.fail()
|
||||
|
||||
|
||||
def test_psql_invalid_vault_port(self):
|
||||
try:
|
||||
src.Database(dbname="sdfk", vault_url="localhost", vault_port="a", token="bla")
|
||||
except:
|
||||
#TODO check the error message
|
||||
return
|
||||
else:
|
||||
self.fail()
|
||||
|
||||
|
||||
def test_psql_valid(self):
|
||||
print(src.Database(dbname="psql", vault_url="http://localhost", token="s.GoR2nisHPeKU1vOaw9hZ5L7h").get_creds())
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Reference in New Issue
Block a user