diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7dab5d1..82b3bce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,9 +21,6 @@ jobs: - run: npm i conf - - name: Generate conf output - run: node tests/main.mjs - - name: Run Tests shell: bash run: | diff --git a/.gitignore b/.gitignore index 1121ae6..6086adc 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,9 @@ dist/ **/*.egg-info/ node_modules/ +package.json +package-lock.json + config.json config_plaintext.json key.txt diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..e9e6a80 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "python.testing.unittestArgs": [ + "-v", + "-s", + "./tests", + "-p", + "test_*.py" + ], + "python.testing.pytestEnabled": false, + "python.testing.unittestEnabled": true +} \ No newline at end of file diff --git a/README.md b/README.md index dbcf1dd..81ceaed 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This Python library encrypts/decrypts [`sindresorhus/conf`](https://github.com/s ## Installation ```bash -pip install git+https://github.com/DimmaDont/py-crypt-sindresorhus-conf@1.0.1 +pip install git+https://github.com/DimmaDont/py-crypt-sindresorhus-conf ``` ## Usage example diff --git a/tests/main.mjs b/tests/main.mjs index 3e2e8ca..5eb2505 100644 --- a/tests/main.mjs +++ b/tests/main.mjs @@ -1,16 +1,15 @@ -import fs from 'node:fs' +import fs from "node:fs"; -import Conf from 'conf' +import Conf from "conf"; - -const key = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' -fs.writeFileSync('./key.txt', key) +const key = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; +fs.writeFileSync("./key.txt", key); const config = new Conf({ - projectName: 'foo', - cwd: './', - encryptionKey: key, -}) -config.set({"c": 1, "b": 2, "a": 3}) + projectName: "foo", + cwd: "./", + encryptionKey: key, +}); +config.set({ c: 1, b: 2, a: 3 }); -fs.writeFileSync('./config_plaintext.json', config._serialize(config.store)); +fs.writeFileSync("./config_plaintext.json", config._serialize(config.store)); diff --git a/tests/test_crypt_sindresorhus_conf.py b/tests/test_crypt_sindresorhus_conf.py index 2a640c7..c186ad0 100644 --- a/tests/test_crypt_sindresorhus_conf.py +++ b/tests/test_crypt_sindresorhus_conf.py @@ -1,4 +1,6 @@ import json +import os +import subprocess import unittest from src.crypt_sindresorhus_conf import CryptSindresorhusConf @@ -6,6 +8,8 @@ class TestCryptSindresorhusConf(unittest.TestCase): def setUp(self): + subprocess.run(["node", "tests/main.mjs"], check=True) + with open("key.txt", "rb") as f: key = f.read() @@ -31,3 +35,8 @@ def test_json(self): self.assertEqual(data["c"], 1) self.assertEqual(data["b"], 2) self.assertEqual(data["a"], 3) + + def tearDown(self): + os.remove("key.txt") + os.remove("config.json") + os.remove("config_plaintext.json")