From f6550a28bbb3a86004e64514b591e0b8e3e16322 Mon Sep 17 00:00:00 2001 From: bvanroll Date: Tue, 23 Mar 2021 13:16:59 +0100 Subject: [PATCH] ok, now we use testpypi --- .github/workflows/python-publish.yml | 2 +- setup.py | 4 ++-- test/database.py | 36 ++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 test/database.py diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 1a03a7b..857b8ae 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -28,4 +28,4 @@ jobs: TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | python setup.py sdist bdist_wheel - twine upload dist/* + twine upload --repository testpypi dist/* diff --git a/setup.py b/setup.py index b6ce63d..b845d28 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setuptools.setup( - name="vaultdatabaseengine-bvanroll", # Replace with your own username + name="vault-db-bvanroll", # Replace with your own username version="0.0.1", author="Beppe Vanrolleghem", author_email="beppe.vanrolleghem@gmail.com", @@ -23,4 +23,4 @@ setuptools.setup( package_dir={"": "vaultdatabaseengine"}, packages=setuptools.find_packages(where="src"), python_requires=">=3.6", -) \ No newline at end of file +) diff --git a/test/database.py b/test/database.py new file mode 100644 index 0000000..15c56bf --- /dev/null +++ b/test/database.py @@ -0,0 +1,36 @@ +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()