mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-17 11:38:32 +02:00
Merge branch 'develop' into docs-reference-1300
This commit is contained in:
commit
d051a030ce
21 changed files with 409 additions and 286 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -2,7 +2,6 @@
|
|||
|
||||
# C extensions
|
||||
*.so
|
||||
.python-version
|
||||
|
||||
# Packages
|
||||
*.egg
|
||||
|
@ -17,7 +16,10 @@ sdist
|
|||
develop-eggs
|
||||
.installed.cfg
|
||||
lib64
|
||||
|
||||
# Versioning
|
||||
.python-version
|
||||
.tool-version
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
|
|
20
CHANGELOG.md
20
CHANGELOG.md
|
@ -1,13 +1,29 @@
|
|||
# Changelog
|
||||
|
||||
## [Unreleased](https://github.com/jrnl-org/jrnl/)
|
||||
## [v2.8.4-beta1](https://pypi.org/project/jrnl/v2.8.4-beta1/) (2021-12-11)
|
||||
|
||||
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.8.4-beta...HEAD)
|
||||
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.8.4-beta...v2.8.4-beta1)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- Wrong delete count when manually changing entries [\#1198](https://github.com/jrnl-org/jrnl/issues/1198)
|
||||
- Add added option to \_print\_edited\_summary [\#1366](https://github.com/jrnl-org/jrnl/pull/1366) ([piero-vic](https://github.com/piero-vic))
|
||||
|
||||
**Build:**
|
||||
|
||||
- Pytest BDD follow-up tasks [\#1287](https://github.com/jrnl-org/jrnl/issues/1287)
|
||||
- Improve handling of mocking logic in pytest [\#1382](https://github.com/jrnl-org/jrnl/pull/1382) ([wren](https://github.com/wren))
|
||||
- Use full Python version for GitHub Actions cache key [\#1373](https://github.com/jrnl-org/jrnl/pull/1373) ([micahellison](https://github.com/micahellison))
|
||||
|
||||
**Packaging:**
|
||||
|
||||
- Bump yq from 2.12.2 to 2.13.0 [\#1385](https://github.com/jrnl-org/jrnl/pull/1385) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- Bump black from 21.11b1 to 21.12b0 [\#1384](https://github.com/jrnl-org/jrnl/pull/1384) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- Bump keyring from 23.3.0 to 23.4.0 [\#1383](https://github.com/jrnl-org/jrnl/pull/1383) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- Bump keyring from 23.2.1 to 23.3.0 [\#1381](https://github.com/jrnl-org/jrnl/pull/1381) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- Bump cryptography from 35.0.0 to 36.0.0 [\#1379](https://github.com/jrnl-org/jrnl/pull/1379) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||
- Bump black from 21.10b0 to 21.11b1 [\#1375](https://github.com/jrnl-org/jrnl/pull/1375) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||
|
||||
## [v2.8.4-beta](https://pypi.org/project/jrnl/v2.8.4-beta/) (2021-11-06)
|
||||
|
||||
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v2.8.3...v2.8.4-beta)
|
||||
|
|
|
@ -1 +1 @@
|
|||
__version__ = "v2.8.4-beta"
|
||||
__version__ = "v2.8.4-beta1"
|
||||
|
|
|
@ -275,13 +275,18 @@ def _edit_search_results(config, journal, old_entries, **kwargs):
|
|||
|
||||
def _print_edited_summary(journal, old_stats, **kwargs):
|
||||
stats = {
|
||||
"added": len(journal) - old_stats["count"],
|
||||
"deleted": old_stats["count"] - len(journal),
|
||||
"modified": len([e for e in journal.entries if e.modified]),
|
||||
}
|
||||
|
||||
prompts = []
|
||||
|
||||
if stats["deleted"]:
|
||||
if stats["added"] > 0:
|
||||
prompts.append(f"{stats['added']} {_pluralize_entry(stats['added'])} added")
|
||||
stats["modified"] -= stats["added"]
|
||||
|
||||
if stats["deleted"] > 0:
|
||||
prompts.append(
|
||||
f"{stats['deleted']} {_pluralize_entry(stats['deleted'])} deleted"
|
||||
)
|
||||
|
|
122
poetry.lock
generated
122
poetry.lock
generated
|
@ -71,7 +71,7 @@ python-versions = "*"
|
|||
|
||||
[[package]]
|
||||
name = "black"
|
||||
version = "21.10b0"
|
||||
version = "21.12b0"
|
||||
description = "The uncompromising code formatter."
|
||||
category = "dev"
|
||||
optional = false
|
||||
|
@ -82,9 +82,8 @@ click = ">=7.1.2"
|
|||
mypy-extensions = ">=0.4.3"
|
||||
pathspec = ">=0.9.0,<1"
|
||||
platformdirs = ">=2"
|
||||
regex = ">=2020.1.8"
|
||||
tomli = ">=0.2.6,<2.0.0"
|
||||
typed-ast = {version = ">=1.4.2", markers = "python_version < \"3.8\""}
|
||||
typed-ast = {version = ">=1.4.2", markers = "python_version < \"3.8\" and implementation_name == \"cpython\""}
|
||||
typing-extensions = [
|
||||
{version = ">=3.10.0.0", markers = "python_version < \"3.10\""},
|
||||
{version = "!=3.10.0.1", markers = "python_version >= \"3.10\""},
|
||||
|
@ -141,7 +140,7 @@ test = ["flake8 (==3.7.8)", "hypothesis (==3.55.3)"]
|
|||
|
||||
[[package]]
|
||||
name = "cryptography"
|
||||
version = "35.0.0"
|
||||
version = "36.0.0"
|
||||
description = "cryptography is a package which provides cryptographic recipes and primitives to Python developers."
|
||||
category = "main"
|
||||
optional = false
|
||||
|
@ -152,7 +151,7 @@ cffi = ">=1.12"
|
|||
|
||||
[package.extras]
|
||||
docs = ["sphinx (>=1.6.5,!=1.8.0,!=3.1.0,!=3.1.1)", "sphinx-rtd-theme"]
|
||||
docstest = ["doc8", "pyenchant (>=1.6.11)", "twine (>=1.12.0)", "sphinxcontrib-spelling (>=4.0.1)"]
|
||||
docstest = ["pyenchant (>=1.6.11)", "twine (>=1.12.0)", "sphinxcontrib-spelling (>=4.0.1)"]
|
||||
pep8test = ["black", "flake8", "flake8-import-order", "pep8-naming"]
|
||||
sdist = ["setuptools_rust (>=0.11.4)"]
|
||||
ssh = ["bcrypt (>=3.1.5)"]
|
||||
|
@ -314,7 +313,7 @@ i18n = ["Babel (>=2.7)"]
|
|||
|
||||
[[package]]
|
||||
name = "keyring"
|
||||
version = "23.2.1"
|
||||
version = "23.4.0"
|
||||
description = "Store and access your passwords safely."
|
||||
category = "main"
|
||||
optional = false
|
||||
|
@ -327,8 +326,8 @@ pywin32-ctypes = {version = "<0.1.0 || >0.1.0,<0.1.1 || >0.1.1", markers = "sys_
|
|||
SecretStorage = {version = ">=3.2", markers = "sys_platform == \"linux\""}
|
||||
|
||||
[package.extras]
|
||||
docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]
|
||||
testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-black (>=0.3.7)", "pytest-mypy"]
|
||||
docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)", "jaraco.tidelift (>=1.4)"]
|
||||
testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-black (>=0.3.7)", "pytest-mypy"]
|
||||
|
||||
[[package]]
|
||||
name = "mako"
|
||||
|
@ -729,14 +728,6 @@ python-versions = ">=3.6"
|
|||
[package.dependencies]
|
||||
pyyaml = "*"
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "2021.10.23"
|
||||
description = "Alternative regular expression module, to replace re."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "rich"
|
||||
version = "10.12.0"
|
||||
|
@ -865,20 +856,20 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
|
|||
|
||||
[[package]]
|
||||
name = "yq"
|
||||
version = "2.12.2"
|
||||
version = "2.13.0"
|
||||
description = "Command-line YAML/XML processor - jq wrapper for YAML/XML documents"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[package.dependencies]
|
||||
argcomplete = ">=1.8.1"
|
||||
PyYAML = ">=3.11"
|
||||
PyYAML = ">=5.3.1"
|
||||
toml = ">=0.10.0"
|
||||
xmltodict = ">=0.11.0"
|
||||
|
||||
[package.extras]
|
||||
test = ["coverage", "flake8", "wheel"]
|
||||
tests = ["coverage", "flake8", "wheel"]
|
||||
|
||||
[[package]]
|
||||
name = "zipp"
|
||||
|
@ -929,8 +920,8 @@ backcall = [
|
|||
{file = "backcall-0.2.0.tar.gz", hash = "sha256:5cbdbf27be5e7cfadb448baf0aa95508f91f2bbc6c6437cd9cd06e2a4c215e1e"},
|
||||
]
|
||||
black = [
|
||||
{file = "black-21.10b0-py3-none-any.whl", hash = "sha256:6eb7448da9143ee65b856a5f3676b7dda98ad9abe0f87fce8c59291f15e82a5b"},
|
||||
{file = "black-21.10b0.tar.gz", hash = "sha256:a9952229092e325fe5f3dae56d81f639b23f7131eb840781947e4b2886030f33"},
|
||||
{file = "black-21.12b0-py3-none-any.whl", hash = "sha256:a615e69ae185e08fdd73e4715e260e2479c861b5740057fde6e8b4e3b7dd589f"},
|
||||
{file = "black-21.12b0.tar.gz", hash = "sha256:77b80f693a569e2e527958459634f18df9b0ba2625ba4e0c2d5da5be42e6f2b3"},
|
||||
]
|
||||
cffi = [
|
||||
{file = "cffi-1.15.0-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:c2502a1a03b6312837279c8c1bd3ebedf6c12c4228ddbad40912d671ccc8a962"},
|
||||
|
@ -997,26 +988,27 @@ commonmark = [
|
|||
{file = "commonmark-0.9.1.tar.gz", hash = "sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60"},
|
||||
]
|
||||
cryptography = [
|
||||
{file = "cryptography-35.0.0-cp36-abi3-macosx_10_10_x86_64.whl", hash = "sha256:d57e0cdc1b44b6cdf8af1d01807db06886f10177469312fbde8f44ccbb284bc9"},
|
||||
{file = "cryptography-35.0.0-cp36-abi3-macosx_11_0_arm64.whl", hash = "sha256:ced40344e811d6abba00295ced98c01aecf0c2de39481792d87af4fa58b7b4d6"},
|
||||
{file = "cryptography-35.0.0-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:54b2605e5475944e2213258e0ab8696f4f357a31371e538ef21e8d61c843c28d"},
|
||||
{file = "cryptography-35.0.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl", hash = "sha256:7b7ceeff114c31f285528ba8b390d3e9cfa2da17b56f11d366769a807f17cbaa"},
|
||||
{file = "cryptography-35.0.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2d69645f535f4b2c722cfb07a8eab916265545b3475fdb34e0be2f4ee8b0b15e"},
|
||||
{file = "cryptography-35.0.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4a2d0e0acc20ede0f06ef7aa58546eee96d2592c00f450c9acb89c5879b61992"},
|
||||
{file = "cryptography-35.0.0-cp36-abi3-manylinux_2_24_x86_64.whl", hash = "sha256:07bb7fbfb5de0980590ddfc7f13081520def06dc9ed214000ad4372fb4e3c7f6"},
|
||||
{file = "cryptography-35.0.0-cp36-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:7eba2cebca600a7806b893cb1d541a6e910afa87e97acf2021a22b32da1df52d"},
|
||||
{file = "cryptography-35.0.0-cp36-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:18d90f4711bf63e2fb21e8c8e51ed8189438e6b35a6d996201ebd98a26abbbe6"},
|
||||
{file = "cryptography-35.0.0-cp36-abi3-win32.whl", hash = "sha256:c10c797ac89c746e488d2ee92bd4abd593615694ee17b2500578b63cad6b93a8"},
|
||||
{file = "cryptography-35.0.0-cp36-abi3-win_amd64.whl", hash = "sha256:7075b304cd567694dc692ffc9747f3e9cb393cc4aa4fb7b9f3abd6f5c4e43588"},
|
||||
{file = "cryptography-35.0.0-pp36-pypy36_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:a688ebcd08250eab5bb5bca318cc05a8c66de5e4171a65ca51db6bd753ff8953"},
|
||||
{file = "cryptography-35.0.0-pp36-pypy36_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d99915d6ab265c22873f1b4d6ea5ef462ef797b4140be4c9d8b179915e0985c6"},
|
||||
{file = "cryptography-35.0.0-pp36-pypy36_pp73-manylinux_2_24_x86_64.whl", hash = "sha256:928185a6d1ccdb816e883f56ebe92e975a262d31cc536429041921f8cb5a62fd"},
|
||||
{file = "cryptography-35.0.0-pp37-pypy37_pp73-macosx_10_10_x86_64.whl", hash = "sha256:ebeddd119f526bcf323a89f853afb12e225902a24d29b55fe18dd6fcb2838a76"},
|
||||
{file = "cryptography-35.0.0-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:22a38e96118a4ce3b97509443feace1d1011d0571fae81fc3ad35f25ba3ea999"},
|
||||
{file = "cryptography-35.0.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eb80e8a1f91e4b7ef8b33041591e6d89b2b8e122d787e87eeb2b08da71bb16ad"},
|
||||
{file = "cryptography-35.0.0-pp37-pypy37_pp73-manylinux_2_24_x86_64.whl", hash = "sha256:abb5a361d2585bb95012a19ed9b2c8f412c5d723a9836418fab7aaa0243e67d2"},
|
||||
{file = "cryptography-35.0.0-pp37-pypy37_pp73-win_amd64.whl", hash = "sha256:1ed82abf16df40a60942a8c211251ae72858b25b7421ce2497c2eb7a1cee817c"},
|
||||
{file = "cryptography-35.0.0.tar.gz", hash = "sha256:9933f28f70d0517686bd7de36166dda42094eac49415459d9bdf5e7df3e0086d"},
|
||||
{file = "cryptography-36.0.0-cp36-abi3-macosx_10_10_universal2.whl", hash = "sha256:9511416e85e449fe1de73f7f99b21b3aa04fba4c4d335d30c486ba3756e3a2a6"},
|
||||
{file = "cryptography-36.0.0-cp36-abi3-macosx_10_10_x86_64.whl", hash = "sha256:97199a13b772e74cdcdb03760c32109c808aff7cd49c29e9cf4b7754bb725d1d"},
|
||||
{file = "cryptography-36.0.0-cp36-abi3-macosx_11_0_arm64.whl", hash = "sha256:494106e9cd945c2cadfce5374fa44c94cfadf01d4566a3b13bb487d2e6c7959e"},
|
||||
{file = "cryptography-36.0.0-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:6fbbbb8aab4053fa018984bb0e95a16faeb051dd8cca15add2a27e267ba02b58"},
|
||||
{file = "cryptography-36.0.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl", hash = "sha256:684993ff6f67000a56454b41bdc7e015429732d65a52d06385b6e9de6181c71e"},
|
||||
{file = "cryptography-36.0.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4c702855cd3174666ef0d2d13dcc879090aa9c6c38f5578896407a7028f75b9f"},
|
||||
{file = "cryptography-36.0.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d91bc9f535599bed58f6d2e21a2724cb0c3895bf41c6403fe881391d29096f1d"},
|
||||
{file = "cryptography-36.0.0-cp36-abi3-manylinux_2_24_x86_64.whl", hash = "sha256:b17d83b3d1610e571fedac21b2eb36b816654d6f7496004d6a0d32f99d1d8120"},
|
||||
{file = "cryptography-36.0.0-cp36-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:8982c19bb90a4fa2aad3d635c6d71814e38b643649b4000a8419f8691f20ac44"},
|
||||
{file = "cryptography-36.0.0-cp36-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:24469d9d33217ffd0ce4582dfcf2a76671af115663a95328f63c99ec7ece61a4"},
|
||||
{file = "cryptography-36.0.0-cp36-abi3-win32.whl", hash = "sha256:f6a5a85beb33e57998dc605b9dbe7deaa806385fdf5c4810fb849fcd04640c81"},
|
||||
{file = "cryptography-36.0.0-cp36-abi3-win_amd64.whl", hash = "sha256:2deab5ec05d83ddcf9b0916319674d3dae88b0e7ee18f8962642d3cde0496568"},
|
||||
{file = "cryptography-36.0.0-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:2049f8b87f449fc6190350de443ee0c1dd631f2ce4fa99efad2984de81031681"},
|
||||
{file = "cryptography-36.0.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a776bae1629c8d7198396fd93ec0265f8dd2341c553dc32b976168aaf0e6a636"},
|
||||
{file = "cryptography-36.0.0-pp37-pypy37_pp73-manylinux_2_24_x86_64.whl", hash = "sha256:aa94d617a4cd4cdf4af9b5af65100c036bce22280ebb15d8b5262e8273ebc6ba"},
|
||||
{file = "cryptography-36.0.0-pp38-pypy38_pp73-macosx_10_10_x86_64.whl", hash = "sha256:5c49c9e8fb26a567a2b3fa0343c89f5d325447956cc2fc7231c943b29a973712"},
|
||||
{file = "cryptography-36.0.0-pp38-pypy38_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:ef216d13ac8d24d9cd851776662f75f8d29c9f2d05cdcc2d34a18d32463a9b0b"},
|
||||
{file = "cryptography-36.0.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:231c4a69b11f6af79c1495a0e5a85909686ea8db946935224b7825cfb53827ed"},
|
||||
{file = "cryptography-36.0.0-pp38-pypy38_pp73-manylinux_2_24_x86_64.whl", hash = "sha256:f92556f94e476c1b616e6daec5f7ddded2c082efa7cee7f31c7aeda615906ed8"},
|
||||
{file = "cryptography-36.0.0-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:d73e3a96c38173e0aa5646c31bf8473bc3564837977dd480f5cbeacf1d7ef3a3"},
|
||||
{file = "cryptography-36.0.0.tar.gz", hash = "sha256:52f769ecb4ef39865719aedc67b4b7eae167bafa48dbc2a26dd36fa56460507f"},
|
||||
]
|
||||
decorator = [
|
||||
{file = "decorator-5.1.0-py3-none-any.whl", hash = "sha256:7b12e7c3c6ab203a29e157335e9122cb03de9ab7264b137594103fd4a683b374"},
|
||||
|
@ -1061,8 +1053,8 @@ jinja2 = [
|
|||
{file = "Jinja2-3.0.2.tar.gz", hash = "sha256:827a0e32839ab1600d4eb1c4c33ec5a8edfbc5cb42dafa13b81f182f97784b45"},
|
||||
]
|
||||
keyring = [
|
||||
{file = "keyring-23.2.1-py3-none-any.whl", hash = "sha256:bd2145a237ed70c8ce72978b497619ddfcae640b6dcf494402d5143e37755c6e"},
|
||||
{file = "keyring-23.2.1.tar.gz", hash = "sha256:6334aee6073db2fb1f30892697b1730105b5e9a77ce7e61fca6b435225493efe"},
|
||||
{file = "keyring-23.4.0-py3-none-any.whl", hash = "sha256:3dc0f66062a4f8f6f2ce30d6a516e6e623e6c3c2e76864204ceaf64695408f07"},
|
||||
{file = "keyring-23.4.0.tar.gz", hash = "sha256:88f206024295e3c6fb16bb0a60fb4bb7ec1185629dc5a729f12aa7c236d01387"},
|
||||
]
|
||||
mako = [
|
||||
{file = "Mako-1.1.5-py2.py3-none-any.whl", hash = "sha256:6804ee66a7f6a6416910463b00d76a7b25194cd27f1918500c5bd7be2a088a23"},
|
||||
|
@ -1308,44 +1300,6 @@ pyyaml-env-tag = [
|
|||
{file = "pyyaml_env_tag-0.1-py3-none-any.whl", hash = "sha256:af31106dec8a4d68c60207c1886031cbf839b68aa7abccdb19868200532c2069"},
|
||||
{file = "pyyaml_env_tag-0.1.tar.gz", hash = "sha256:70092675bda14fdec33b31ba77e7543de9ddc88f2e5b99160396572d11525bdb"},
|
||||
]
|
||||
regex = [
|
||||
{file = "regex-2021.10.23-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:45b65d6a275a478ac2cbd7fdbf7cc93c1982d613de4574b56fd6972ceadb8395"},
|
||||
{file = "regex-2021.10.23-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:74d071dbe4b53c602edd87a7476ab23015a991374ddb228d941929ad7c8c922e"},
|
||||
{file = "regex-2021.10.23-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:34d870f9f27f2161709054d73646fc9aca49480617a65533fc2b4611c518e455"},
|
||||
{file = "regex-2021.10.23-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2fb698037c35109d3c2e30f2beb499e5ebae6e4bb8ff2e60c50b9a805a716f79"},
|
||||
{file = "regex-2021.10.23-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:cb46b542133999580ffb691baf67410306833ee1e4f58ed06b6a7aaf4e046952"},
|
||||
{file = "regex-2021.10.23-cp310-cp310-win32.whl", hash = "sha256:5e9c9e0ce92f27cef79e28e877c6b6988c48b16942258f3bc55d39b5f911df4f"},
|
||||
{file = "regex-2021.10.23-cp310-cp310-win_amd64.whl", hash = "sha256:ab7c5684ff3538b67df3f93d66bd3369b749087871ae3786e70ef39e601345b0"},
|
||||
{file = "regex-2021.10.23-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:de557502c3bec8e634246588a94e82f1ee1b9dfcfdc453267c4fb652ff531570"},
|
||||
{file = "regex-2021.10.23-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ee684f139c91e69fe09b8e83d18b4d63bf87d9440c1eb2eeb52ee851883b1b29"},
|
||||
{file = "regex-2021.10.23-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:5095a411c8479e715784a0c9236568ae72509450ee2226b649083730f3fadfc6"},
|
||||
{file = "regex-2021.10.23-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7b568809dca44cb75c8ebb260844ea98252c8c88396f9d203f5094e50a70355f"},
|
||||
{file = "regex-2021.10.23-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:eb672217f7bd640411cfc69756ce721d00ae600814708d35c930930f18e8029f"},
|
||||
{file = "regex-2021.10.23-cp36-cp36m-win32.whl", hash = "sha256:a7a986c45d1099a5de766a15de7bee3840b1e0e1a344430926af08e5297cf666"},
|
||||
{file = "regex-2021.10.23-cp36-cp36m-win_amd64.whl", hash = "sha256:6d7722136c6ed75caf84e1788df36397efdc5dbadab95e59c2bba82d4d808a4c"},
|
||||
{file = "regex-2021.10.23-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:9f665677e46c5a4d288ece12fdedf4f4204a422bb28ff05f0e6b08b7447796d1"},
|
||||
{file = "regex-2021.10.23-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:450dc27483548214314640c89a0f275dbc557968ed088da40bde7ef8fb52829e"},
|
||||
{file = "regex-2021.10.23-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:129472cd06062fb13e7b4670a102951a3e655e9b91634432cfbdb7810af9d710"},
|
||||
{file = "regex-2021.10.23-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a940ca7e7189d23da2bfbb38973832813eab6bd83f3bf89a977668c2f813deae"},
|
||||
{file = "regex-2021.10.23-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:530fc2bbb3dc1ebb17f70f7b234f90a1dd43b1b489ea38cea7be95fb21cdb5c7"},
|
||||
{file = "regex-2021.10.23-cp37-cp37m-win32.whl", hash = "sha256:ded0c4a3eee56b57fcb2315e40812b173cafe79d2f992d50015f4387445737fa"},
|
||||
{file = "regex-2021.10.23-cp37-cp37m-win_amd64.whl", hash = "sha256:391703a2abf8013d95bae39145d26b4e21531ab82e22f26cd3a181ee2644c234"},
|
||||
{file = "regex-2021.10.23-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:be04739a27be55631069b348dda0c81d8ea9822b5da10b8019b789e42d1fe452"},
|
||||
{file = "regex-2021.10.23-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:13ec99df95003f56edcd307db44f06fbeb708c4ccdcf940478067dd62353181e"},
|
||||
{file = "regex-2021.10.23-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:8d1cdcda6bd16268316d5db1038965acf948f2a6f43acc2e0b1641ceab443623"},
|
||||
{file = "regex-2021.10.23-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0c186691a7995ef1db61205e00545bf161fb7b59cdb8c1201c89b333141c438a"},
|
||||
{file = "regex-2021.10.23-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:2b20f544cbbeffe171911f6ce90388ad36fe3fad26b7c7a35d4762817e9ea69c"},
|
||||
{file = "regex-2021.10.23-cp38-cp38-win32.whl", hash = "sha256:c0938ddd60cc04e8f1faf7a14a166ac939aac703745bfcd8e8f20322a7373019"},
|
||||
{file = "regex-2021.10.23-cp38-cp38-win_amd64.whl", hash = "sha256:56f0c81c44638dfd0e2367df1a331b4ddf2e771366c4b9c5d9a473de75e3e1c7"},
|
||||
{file = "regex-2021.10.23-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:80bb5d2e92b2258188e7dcae5b188c7bf868eafdf800ea6edd0fbfc029984a88"},
|
||||
{file = "regex-2021.10.23-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e1dae12321b31059a1a72aaa0e6ba30156fe7e633355e445451e4021b8e122b6"},
|
||||
{file = "regex-2021.10.23-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:1f2b59c28afc53973d22e7bc18428721ee8ca6079becf1b36571c42627321c65"},
|
||||
{file = "regex-2021.10.23-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d134757a37d8640f3c0abb41f5e68b7cf66c644f54ef1cb0573b7ea1c63e1509"},
|
||||
{file = "regex-2021.10.23-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:0dcc0e71118be8c69252c207630faf13ca5e1b8583d57012aae191e7d6d28b84"},
|
||||
{file = "regex-2021.10.23-cp39-cp39-win32.whl", hash = "sha256:a30513828180264294953cecd942202dfda64e85195ae36c265daf4052af0464"},
|
||||
{file = "regex-2021.10.23-cp39-cp39-win_amd64.whl", hash = "sha256:0f7552429dd39f70057ac5d0e897e5bfe211629652399a21671e53f2a9693a4e"},
|
||||
{file = "regex-2021.10.23.tar.gz", hash = "sha256:f3f9a91d3cc5e5b0ddf1043c0ae5fa4852f18a1c0050318baf5fc7930ecc1f9c"},
|
||||
]
|
||||
rich = [
|
||||
{file = "rich-10.12.0-py3-none-any.whl", hash = "sha256:c30d6808d1cd3defd56a7bd2d587d13e53b5f55de6cf587f035bcbb56bc3f37b"},
|
||||
{file = "rich-10.12.0.tar.gz", hash = "sha256:83fb3eff778beec3c55201455c17cccde1ccdf66d5b4dade8ef28f56b50c4bd4"},
|
||||
|
@ -1449,8 +1403,8 @@ xmltodict = [
|
|||
{file = "xmltodict-0.12.0.tar.gz", hash = "sha256:50d8c638ed7ecb88d90561beedbf720c9b4e851a9fa6c47ebd64e99d166d8a21"},
|
||||
]
|
||||
yq = [
|
||||
{file = "yq-2.12.2-py2.py3-none-any.whl", hash = "sha256:9fdf4487a6dbf985ca1d357ec93f926d982813e8e896e8892bae95162b6defe3"},
|
||||
{file = "yq-2.12.2.tar.gz", hash = "sha256:2f156d0724b61487ac8752ed4eaa702a5737b804d5afa46fa55866951cd106d2"},
|
||||
{file = "yq-2.13.0-py2.py3-none-any.whl", hash = "sha256:3ae1f647c85f76d48005d75445917cbea2f4d734bae9c7409372340583c2a6c1"},
|
||||
{file = "yq-2.13.0.tar.gz", hash = "sha256:fd131fdb1f56716ad8d44cd9eaaf7d3b22d39ba8861ea64a409cc3f4ae263db8"},
|
||||
]
|
||||
zipp = [
|
||||
{file = "zipp-3.6.0-py3-none-any.whl", hash = "sha256:9fe5ea21568a0a70e50f273397638d39b03353731e6cbbb3fd8502a33fec40bc"},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "jrnl"
|
||||
version = "v2.8.4-beta"
|
||||
version = "v2.8.4-beta1"
|
||||
description = "Collect your thoughts and notes without leaving the command line."
|
||||
authors = [
|
||||
"jrnl contributors <jrnl-sh@googlegroups.com>",
|
||||
|
|
|
@ -29,7 +29,7 @@ Feature: Multiple journals
|
|||
Given the config "multiple.yaml" exists
|
||||
And we use the config "basic_onefile.yaml"
|
||||
When we run "jrnl --cf multiple.yaml work a long day in the office"
|
||||
Then we should see the message "Entry added to work journal"
|
||||
Then the output should contain "Entry added to work journal"
|
||||
|
||||
Scenario: Write to specified journal with a timestamp using an alternate config
|
||||
Given the config "multiple.yaml" exists
|
||||
|
@ -64,7 +64,7 @@ Feature: Multiple journals
|
|||
Given the config "bug343.yaml" exists
|
||||
And we use the config "basic_onefile.yaml"
|
||||
When we run "jrnl --cf bug343.yaml a long day in the office"
|
||||
Then we should see the message "No default journal configured"
|
||||
Then the output should contain "No default journal configured"
|
||||
|
||||
Scenario: Don't crash if no file exists for a configured encrypted journal using an alternate config
|
||||
Given the config "multiple.yaml" exists
|
||||
|
@ -73,7 +73,7 @@ Feature: Multiple journals
|
|||
these three eyes
|
||||
these three eyes
|
||||
n
|
||||
Then we should see the message "Encrypted journal 'new_encrypted' created"
|
||||
Then the output should contain "Encrypted journal 'new_encrypted' created"
|
||||
|
||||
Scenario: Don't overwrite main config when encrypting a journal in an alternate config
|
||||
Given the config "basic_onefile.yaml" exists
|
||||
|
@ -82,11 +82,14 @@ Feature: Multiple journals
|
|||
these three eyes
|
||||
these three eyes
|
||||
n
|
||||
Then we should see the message "Journal encrypted to features/journals/basic_onefile.journal"
|
||||
And the config should contain "encrypt: false" # multiple.yaml remains unchanged
|
||||
Then the output should contain "Journal encrypted to features/journals/basic_onefile.journal"
|
||||
And the config should contain "encrypt: false"
|
||||
|
||||
|
||||
Scenario: Don't overwrite main config when decrypting a journal in an alternate config
|
||||
Given the config "editor_encrypted.yaml" exists
|
||||
And we use the password "bad doggie no biscuit" if prompted
|
||||
And we use the config "basic_encrypted.yaml"
|
||||
When we run "jrnl --cf editor_encrypted.yaml --decrypt"
|
||||
Then the config should contain "encrypt: true" # basic_encrypted remains unchanged
|
||||
Then the config should contain "encrypt: true"
|
||||
And the output should not contain "Wrong password"
|
||||
|
|
|
@ -4,7 +4,7 @@ Feature: Reading and writing to journal with custom date formats
|
|||
# https://github.com/jrnl-org/jrnl/issues/117
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl 2013-11-30 15:42: Project Started."
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl -999"
|
||||
Then the output should contain "2013-11-30 15:42 Project Started."
|
||||
|
||||
|
@ -13,7 +13,7 @@ Feature: Reading and writing to journal with custom date formats
|
|||
# https://github.com/jrnl-org/jrnl/issues/185
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl 26/06/2099: Planet? Earth. Year? 2099."
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl -999"
|
||||
Then the output should contain "2099-06-26 09:00 Planet?"
|
||||
|
||||
|
@ -34,7 +34,7 @@ Feature: Reading and writing to journal with custom date formats
|
|||
Scenario Outline: Writing an entry from command line with custom date
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl <command>"
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl -n 1"
|
||||
Then the output should contain "<expected_output>"
|
||||
|
||||
|
@ -87,7 +87,7 @@ Feature: Reading and writing to journal with custom date formats
|
|||
Given we use the config "simple.yaml"
|
||||
And now is "2019-03-12 01:30:32 PM"
|
||||
When we run "jrnl <command>"
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl -1"
|
||||
Then the output should contain "<expected_output>"
|
||||
Then the output should contain the date "<date>"
|
||||
|
@ -109,7 +109,7 @@ Feature: Reading and writing to journal with custom date formats
|
|||
Given we use the config "simple.yaml"
|
||||
And now is "2019-03-12 01:30:32 PM"
|
||||
When we run "jrnl <command>"
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl -1"
|
||||
Then the output should contain "<expected_output>"
|
||||
Then the output should contain the date "<date>"
|
||||
|
|
|
@ -2,8 +2,9 @@ Feature: Encrypting and decrypting journals
|
|||
|
||||
Scenario: Decrypting a journal
|
||||
Given we use the config "encrypted.yaml"
|
||||
# And we use the password "bad doggie no biscuit" if prompted
|
||||
When we run "jrnl --decrypt" and enter "bad doggie no biscuit"
|
||||
Then we should see the message "Journal decrypted"
|
||||
Then the output should contain "Journal decrypted"
|
||||
And the config for journal "default" should contain "encrypt: false"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
|
@ -35,7 +36,7 @@ Feature: Encrypting and decrypting journals
|
|||
swordfish
|
||||
n
|
||||
Then we should get no error
|
||||
And we should see the message "Journal encrypted"
|
||||
And the output should contain "Journal encrypted"
|
||||
And the config for journal "default" should contain "encrypt: true"
|
||||
When we run "jrnl -n 1" and enter "swordfish"
|
||||
Then we should be prompted for a password
|
||||
|
|
|
@ -3,7 +3,7 @@ Feature: Journals iteracting with the file system in a way that users can see
|
|||
Scenario: Adding entries to a Folder journal should generate date files
|
||||
Given we use the config "empty_folder.yaml"
|
||||
When we run "jrnl 23 July 2013: Testing folder journal."
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
And the journal directory should contain
|
||||
2013/07/23.txt
|
||||
|
||||
|
@ -11,7 +11,7 @@ Feature: Journals iteracting with the file system in a way that users can see
|
|||
Given we use the config "empty_folder.yaml"
|
||||
When we run "jrnl 23 July 2013: Testing folder journal."
|
||||
And we run "jrnl 3/7/2014: Second entry of journal."
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
And the journal directory should contain
|
||||
2013/07/23.txt
|
||||
|
||||
|
@ -32,6 +32,7 @@ Feature: Journals iteracting with the file system in a way that users can see
|
|||
Then the output should contain "This is a new entry in my journal"
|
||||
|
||||
Scenario: Creating journal with relative path should update to absolute path
|
||||
Given we use no config
|
||||
When we run "jrnl hello world" and enter
|
||||
test.txt
|
||||
n
|
||||
|
|
|
@ -34,7 +34,7 @@ Feature: Multiple journals
|
|||
Scenario: Tell user which journal was used
|
||||
Given we use the config "multiple.yaml"
|
||||
When we run "jrnl work a long day in the office"
|
||||
Then we should see the message "Entry added to work journal"
|
||||
Then the output should contain "Entry added to work journal"
|
||||
|
||||
Scenario: Write to specified journal with a timestamp
|
||||
Given we use the config "multiple.yaml"
|
||||
|
|
|
@ -3,9 +3,12 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
|
|||
Scenario: Override configured editor with built-in input === editor:''
|
||||
Given we use the config "basic_encrypted.yaml"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --config-override editor ''"
|
||||
When we run "jrnl --config-override editor ''" and enter
|
||||
This is a journal entry
|
||||
Then the stdin prompt should have been called
|
||||
And the editor should not have been called
|
||||
When we run "jrnl -1"
|
||||
Then the output should contain "This is a journal entry"
|
||||
|
||||
|
||||
Scenario: Postconfig commands with overrides
|
||||
|
@ -61,7 +64,7 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
|
|||
And we use the password "test" if prompted
|
||||
When we run "jrnl --config-override journals.default features/journals/simple.journal 20 Mar 2000: The rain in Spain comes from clouds"
|
||||
Then we should get no error
|
||||
And we should see the message "Entry added"
|
||||
And the output should contain "Entry added"
|
||||
When we run "jrnl -3 --config-override journals.default features/journals/simple.journal"
|
||||
Then the output should be
|
||||
2000-03-20 09:00 The rain in Spain comes from clouds
|
||||
|
@ -78,7 +81,7 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
|
|||
And we use the password "test" if prompted
|
||||
When we run "jrnl --config-override journals.temp features/journals/simple.journal temp Sep 06 1969: @say Ni"
|
||||
Then we should get no error
|
||||
And we should see the message "Entry added"
|
||||
And the output should contain "Entry added"
|
||||
When we run "jrnl --config-override journals.temp features/journals/simple.journal temp -3"
|
||||
Then the output should be
|
||||
1969-09-06 09:00 @say Ni
|
||||
|
|
|
@ -55,7 +55,7 @@ Feature: Using the installed keyring
|
|||
this password will not be saved in keyring
|
||||
this password will not be saved in keyring
|
||||
y
|
||||
Then we should see the message "Failed to retrieve keyring"
|
||||
Then the output should contain "Failed to retrieve keyring"
|
||||
And we should get no error
|
||||
And we should be prompted for a password
|
||||
And the config for journal "default" should contain "encrypt: true"
|
||||
|
@ -69,7 +69,7 @@ Feature: Using the installed keyring
|
|||
Then the error output should contain "Failed to retrieve keyring"
|
||||
And we should get no error
|
||||
And we should be prompted for a password
|
||||
And we should see the message "Journal decrypted"
|
||||
And the output should contain "Journal decrypted"
|
||||
And the config for journal "default" should contain "encrypt: false"
|
||||
When we run "jrnl --short"
|
||||
Then we should not be prompted for a password
|
||||
|
@ -96,7 +96,7 @@ Feature: Using the installed keyring
|
|||
swordfish
|
||||
sordfish
|
||||
Then we should be prompted for a password
|
||||
And we should see the message "Passwords did not match"
|
||||
And the output should contain "Passwords did not match"
|
||||
And the config for journal "default" should not contain "encrypt: true"
|
||||
When we run "jrnl --short"
|
||||
Then the output should be
|
||||
|
@ -113,8 +113,8 @@ Feature: Using the installed keyring
|
|||
swordfish
|
||||
n
|
||||
Then we should be prompted for a password
|
||||
And we should see the message "Passwords did not match"
|
||||
And we should see the message "Journal encrypted"
|
||||
And the output should contain "Passwords did not match"
|
||||
And the output should contain "Journal encrypted"
|
||||
And the config for journal "default" should contain "encrypt: true"
|
||||
When we run "jrnl -1" and enter "swordfish"
|
||||
Then we should be prompted for a password
|
||||
|
|
|
@ -3,7 +3,7 @@ Feature: Searching in a journal
|
|||
Scenario Outline: Displaying entries using -on today should display entries created today
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl today: Adding an entry right now."
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl -on today"
|
||||
Then the output should contain "Adding an entry right now."
|
||||
But the output should not contain "Everything is alright"
|
||||
|
@ -18,11 +18,11 @@ Feature: Searching in a journal
|
|||
Scenario Outline: Displaying entries using -from day should display correct entries
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl yesterday: This thing happened yesterday"
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl today at 11:59pm: Adding an entry right now."
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl tomorrow: A future entry."
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl -from today"
|
||||
Then the output should contain "Adding an entry right now."
|
||||
And the output should contain "A future entry."
|
||||
|
@ -37,11 +37,11 @@ Feature: Searching in a journal
|
|||
Scenario Outline: Displaying entries using -from and -to day should display correct entries
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl yesterday: This thing happened yesterday"
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl today at 11:59pm: Adding an entry right now."
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl tomorrow: A future entry."
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl -from yesterday -to today"
|
||||
Then the output should contain "This thing happened yesterday"
|
||||
And the output should contain "Adding an entry right now."
|
||||
|
@ -118,9 +118,9 @@ Feature: Searching in a journal
|
|||
Scenario: Out of order entries to a Folder journal should be listed in date order
|
||||
Given we use the config "empty_folder.yaml"
|
||||
When we run "jrnl 3/7/2014 4:37pm: Second entry of journal."
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl 23 July 2013: Testing folder journal."
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl -2"
|
||||
Then the output should be
|
||||
2013-07-23 09:00 Testing folder journal.
|
||||
|
|
|
@ -3,7 +3,7 @@ Feature: Starring entries
|
|||
Scenario Outline: Starring an entry will mark it in the journal file
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl 20 july 2013 *: Best day of my life!"
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl -on 2013-07-20 -starred"
|
||||
Then the output should contain "2013-07-20 09:00 Best day of my life!"
|
||||
|
||||
|
@ -30,6 +30,6 @@ Feature: Starring entries
|
|||
Scenario: Starring an entry will mark it in an encrypted journal
|
||||
Given we use the config "encrypted.yaml"
|
||||
When we run "jrnl 20 july 2013 *: Best day of my life!" and enter "bad doggie no biscuit"
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl -on 2013-07-20 -starred" and enter "bad doggie no biscuit"
|
||||
Then the output should contain "2013-07-20 09:00 Best day of my life!"
|
||||
|
|
|
@ -46,7 +46,7 @@ Feature: Writing new entries.
|
|||
Given we use the config "<config_file>"
|
||||
And we use the password "bad doggie no biscuit" if prompted
|
||||
When we run "jrnl 23 july 2013: A cold and stormy day. I ate crisps on the sofa."
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl -n 1"
|
||||
Then the output should contain "2013-07-23 09:00 A cold and stormy day."
|
||||
|
||||
|
@ -61,7 +61,7 @@ Feature: Writing new entries.
|
|||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl this is a partial --edit"
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
Then the editor should have been called
|
||||
And the editor file content should be
|
||||
this is a partial
|
||||
|
@ -110,7 +110,7 @@ Feature: Writing new entries.
|
|||
Given we use the config "<config_file>"
|
||||
And we use the password "bad doggie no biscuit" if prompted
|
||||
When we run "jrnl 23 july 2013: A cold and stormy day. I ate crisps on the sofa."
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl -n 1"
|
||||
Then the output should not contain "Life is good"
|
||||
|
||||
|
@ -125,7 +125,7 @@ Feature: Writing new entries.
|
|||
Given we use the config "<config_file>"
|
||||
And we use the password "bad doggie no biscuit" if prompted
|
||||
When we run "jrnl 04-24-2014: Created a new website - empty.com. Hope to get a lot of traffic."
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl -1"
|
||||
Then the output should be
|
||||
2014-04-24 09:00 Created a new website - empty.com.
|
||||
|
@ -142,7 +142,7 @@ Feature: Writing new entries.
|
|||
Given we use the config "<config_file>"
|
||||
And we use the password "bad doggie no biscuit" if prompted
|
||||
When we run "jrnl 23 july 2013: 🌞 sunny day. Saw an 🐘"
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl -n 1"
|
||||
Then the output should contain "🌞"
|
||||
And the output should contain "🐘"
|
||||
|
@ -199,7 +199,7 @@ Feature: Writing new entries.
|
|||
Scenario: Title with an embedded period on DayOne journal
|
||||
Given we use the config "dayone.yaml"
|
||||
When we run "jrnl 04-24-2014: Ran 6.2 miles today in 1:02:03. I am feeling sore because I forgot to stretch."
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl -1"
|
||||
Then the output should be
|
||||
2014-04-24 09:00 Ran 6.2 miles today in 1:02:03.
|
||||
|
@ -208,6 +208,92 @@ Feature: Writing new entries.
|
|||
Scenario: Opening an folder that's not a DayOne folder should treat as folder journal
|
||||
Given we use the config "empty_folder.yaml"
|
||||
When we run "jrnl 23 july 2013: Testing folder journal."
|
||||
Then we should see the message "Entry added"
|
||||
Then the output should contain "Entry added"
|
||||
When we run "jrnl -1"
|
||||
Then the output should be "2013-07-23 09:00 Testing folder journal."
|
||||
|
||||
Scenario Outline: Correctly count when adding a single entry via --edit
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
And we append to the editor if opened
|
||||
[2021-11-13] worked on jrnl tests
|
||||
When we run "jrnl --edit"
|
||||
Then the output should contain
|
||||
[1 entry added]
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
#| basic_dayone.yaml | @todo
|
||||
|
||||
|
||||
Scenario Outline: Correctly count when adding multiple entries via --edit
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
And we append to the editor if opened
|
||||
[2021-11-11] worked on jrnl tests
|
||||
[2021-11-12] worked on jrnl tests again
|
||||
[2021-11-13] worked on jrnl tests a little bit more
|
||||
When we run "jrnl --edit"
|
||||
Then the output should contain
|
||||
[3 entries added]
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
#| basic_dayone.yaml | @todo
|
||||
|
||||
|
||||
Scenario Outline: Correctly count when removing entries via --edit
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
And we write to the editor if opened
|
||||
[2021-11-13] I am replacing my whole journal with this entry
|
||||
When we run "jrnl --edit"
|
||||
Then the output should contain
|
||||
[2 entries deleted, 1 entry modified]
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
#| basic_dayone.yaml | @todo
|
||||
|
||||
|
||||
Scenario Outline: Correctly count modification when running --edit to replace a single entry
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
And we write to the editor if opened
|
||||
[2021-11-13] I am replacing the last entry with this entry
|
||||
When we run "jrnl --edit -1"
|
||||
Then the output should contain
|
||||
[1 entry modified]
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
#| basic_dayone.yaml | @todo
|
||||
|
||||
|
||||
Scenario Outline: Correctly count modification when running --edit on whole journal and adding to last entry
|
||||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
And we append to the editor if opened
|
||||
This is a small addendum to my latest entry.
|
||||
When we run "jrnl --edit"
|
||||
Then the output should contain
|
||||
[1 entry modified]
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
| basic_onefile.yaml |
|
||||
| basic_encrypted.yaml |
|
||||
| basic_folder.yaml |
|
||||
#| basic_dayone.yaml | @todo
|
||||
|
|
|
@ -8,17 +8,19 @@ import tempfile
|
|||
|
||||
from keyring import backend
|
||||
from keyring import errors
|
||||
from keyring import set_keyring
|
||||
from pytest import fixture
|
||||
from unittest.mock import patch
|
||||
from .helpers import get_fixture
|
||||
import toml
|
||||
|
||||
from jrnl.config import load_config
|
||||
from jrnl.os_compat import split_args
|
||||
|
||||
|
||||
# --- Keyring --- #
|
||||
@fixture
|
||||
def keyring():
|
||||
set_keyring(NoKeyring())
|
||||
return NoKeyring()
|
||||
|
||||
|
||||
@fixture
|
||||
|
@ -75,13 +77,90 @@ class FailedKeyring(backend.KeyringBackend):
|
|||
|
||||
# ----- Misc ----- #
|
||||
@fixture
|
||||
def cli_run():
|
||||
return {"status": 0, "stdout": None, "stderr": None}
|
||||
def cli_run(
|
||||
mock_factories,
|
||||
mock_args,
|
||||
mock_is_tty,
|
||||
mock_config_path,
|
||||
mock_editor,
|
||||
mock_user_input,
|
||||
mock_overrides,
|
||||
mock_password,
|
||||
):
|
||||
# Check if we need more mocks
|
||||
mock_factories.update(mock_args)
|
||||
mock_factories.update(mock_is_tty)
|
||||
mock_factories.update(mock_overrides)
|
||||
mock_factories.update(mock_editor)
|
||||
mock_factories.update(mock_config_path)
|
||||
mock_factories.update(mock_user_input)
|
||||
mock_factories.update(mock_password)
|
||||
|
||||
return {
|
||||
"status": 0,
|
||||
"stdout": None,
|
||||
"stderr": None,
|
||||
"mocks": {},
|
||||
"mock_factories": mock_factories,
|
||||
}
|
||||
|
||||
|
||||
@fixture
|
||||
def mocks():
|
||||
return dict()
|
||||
def mock_factories():
|
||||
return {}
|
||||
|
||||
|
||||
@fixture
|
||||
def mock_args(cache_dir, request):
|
||||
def _mock_args():
|
||||
command = get_fixture(request, "command", "")
|
||||
|
||||
if cache_dir["exists"]:
|
||||
command = command.format(cache_dir=cache_dir["path"])
|
||||
|
||||
args = split_args(command)
|
||||
|
||||
return patch("sys.argv", ["jrnl"] + args)
|
||||
|
||||
return {"args": _mock_args}
|
||||
|
||||
|
||||
@fixture
|
||||
def mock_is_tty(is_tty):
|
||||
return {"is_tty": lambda: patch("sys.stdin.isatty", return_value=is_tty)}
|
||||
|
||||
|
||||
@fixture
|
||||
def mock_overrides(config_in_memory):
|
||||
from jrnl.override import apply_overrides
|
||||
|
||||
def my_overrides(*args, **kwargs):
|
||||
result = apply_overrides(*args, **kwargs)
|
||||
config_in_memory["overrides"] = result
|
||||
return result
|
||||
|
||||
return {
|
||||
"overrides": lambda: patch(
|
||||
"jrnl.jrnl.apply_overrides", side_effect=my_overrides
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@fixture
|
||||
def mock_config_path(request):
|
||||
config_path = get_fixture(request, "config_path")
|
||||
|
||||
if not config_path:
|
||||
return {}
|
||||
|
||||
return {
|
||||
"config_path_install": lambda: patch(
|
||||
"jrnl.install.get_config_path", return_value=config_path
|
||||
),
|
||||
"config_path_config": lambda: patch(
|
||||
"jrnl.config.get_config_path", return_value=config_path
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
@fixture
|
||||
|
@ -94,12 +173,6 @@ def working_dir(request):
|
|||
return os.path.join(request.config.rootpath, "tests")
|
||||
|
||||
|
||||
@fixture
|
||||
def config_path(temp_dir):
|
||||
os.chdir(temp_dir.name)
|
||||
return temp_dir.name + "/jrnl.yaml"
|
||||
|
||||
|
||||
@fixture
|
||||
def toml_version(working_dir):
|
||||
pyproject = os.path.join(working_dir, "..", "pyproject.toml")
|
||||
|
@ -108,8 +181,23 @@ def toml_version(working_dir):
|
|||
|
||||
|
||||
@fixture
|
||||
def password():
|
||||
return ""
|
||||
def mock_password(request):
|
||||
def _mock_password():
|
||||
password = get_fixture(request, "password")
|
||||
user_input = get_fixture(request, "user_input")
|
||||
|
||||
if password:
|
||||
password = password.splitlines()
|
||||
|
||||
elif user_input:
|
||||
password = user_input.splitlines()
|
||||
|
||||
if not password:
|
||||
password = Exception("Unexpected call for password")
|
||||
|
||||
return patch("getpass.getpass", side_effect=password)
|
||||
|
||||
return {"getpass": _mock_password}
|
||||
|
||||
|
||||
@fixture
|
||||
|
@ -127,19 +215,36 @@ def str_value():
|
|||
return ""
|
||||
|
||||
|
||||
@fixture
|
||||
def command():
|
||||
return ""
|
||||
|
||||
|
||||
@fixture
|
||||
def should_not():
|
||||
return False
|
||||
|
||||
|
||||
@fixture
|
||||
def user_input():
|
||||
return ""
|
||||
def mock_user_input(request, is_tty):
|
||||
def _generator(target):
|
||||
def _mock_user_input():
|
||||
user_input = get_fixture(request, "user_input", None)
|
||||
|
||||
if user_input is None:
|
||||
user_input = Exception("Unexpected call for user input")
|
||||
else:
|
||||
user_input = user_input.splitlines() if is_tty else [user_input]
|
||||
|
||||
return patch(target, side_effect=user_input)
|
||||
|
||||
return _mock_user_input
|
||||
|
||||
return {
|
||||
"stdin": _generator("sys.stdin.read"),
|
||||
"input": _generator("builtins.input"),
|
||||
}
|
||||
|
||||
|
||||
@fixture
|
||||
def is_tty(input_method):
|
||||
assert input_method in ["", "enter", "pipe"]
|
||||
return input_method != "pipe"
|
||||
|
||||
|
||||
@fixture
|
||||
|
@ -187,7 +292,7 @@ def editor_state():
|
|||
|
||||
|
||||
@fixture
|
||||
def editor(editor_state):
|
||||
def mock_editor(editor_state):
|
||||
def _mock_editor(editor_command):
|
||||
tmpfile = editor_command[-1]
|
||||
|
||||
|
@ -203,4 +308,4 @@ def editor(editor_state):
|
|||
file_content = f.read()
|
||||
editor_state["tmpfile"]["content"] = file_content
|
||||
|
||||
return _mock_editor
|
||||
return {"editor": lambda: patch("subprocess.call", side_effect=_mock_editor)}
|
||||
|
|
|
@ -11,7 +11,6 @@ from unittest.mock import MagicMock
|
|||
from unittest.mock import patch
|
||||
from xml.etree import ElementTree
|
||||
|
||||
from keyring import set_keyring
|
||||
from pytest_bdd import given
|
||||
from pytest_bdd.parsers import parse
|
||||
|
||||
|
@ -20,6 +19,7 @@ from jrnl.time import __get_pdt_calendar
|
|||
|
||||
from .fixtures import FailedKeyring
|
||||
from .fixtures import TestKeyring
|
||||
from .helpers import get_fixture
|
||||
|
||||
|
||||
@given(parse("we {editor_method} to the editor if opened\n{editor_input}"))
|
||||
|
@ -36,9 +36,8 @@ def we_enter_editor(editor_method, editor_input, editor_state):
|
|||
editor_state["intent"] = {"method": file_method, "input": editor_input}
|
||||
|
||||
|
||||
@given(parse('now is "<date_str>"'))
|
||||
@given(parse('now is "{date_str}"'))
|
||||
def now_is_str(date_str, mocks):
|
||||
def now_is_str(date_str, mock_factories):
|
||||
class DatetimeMagicMock(MagicMock):
|
||||
# needed because jrnl does some reflection on datetime
|
||||
def __instancecheck__(self, subclass):
|
||||
|
@ -63,8 +62,8 @@ def now_is_str(date_str, mocks):
|
|||
date_str_input, mocked_now()
|
||||
)
|
||||
|
||||
mocks["datetime"] = patch("datetime.datetime", new=datetime_mock)
|
||||
mocks["calendar_parse"] = patch(
|
||||
mock_factories["datetime"] = lambda: patch("datetime.datetime", new=datetime_mock)
|
||||
mock_factories["calendar_parse"] = lambda: patch(
|
||||
"jrnl.time.__get_pdt_calendar", return_value=calendar_mock
|
||||
)
|
||||
|
||||
|
@ -73,17 +72,22 @@ def now_is_str(date_str, mocks):
|
|||
@given(parse("we have a {keyring_type} keyring"), target_fixture="keyring")
|
||||
def we_have_type_of_keyring(keyring_type):
|
||||
if keyring_type == "failed":
|
||||
set_keyring(FailedKeyring())
|
||||
return FailedKeyring()
|
||||
else:
|
||||
set_keyring(TestKeyring())
|
||||
return TestKeyring()
|
||||
|
||||
|
||||
@given(parse('we use the config "{config_file}"'), target_fixture="config_path")
|
||||
@given('we use the config "<config_file>"', target_fixture="config_path")
|
||||
def we_use_the_config(config_file, temp_dir, working_dir):
|
||||
@given(parse("we use no config"), target_fixture="config_path")
|
||||
def we_use_the_config(request, temp_dir, working_dir):
|
||||
config_file = get_fixture(request, "config_file")
|
||||
|
||||
# Move into temp dir as cwd
|
||||
os.chdir(temp_dir.name)
|
||||
|
||||
if not config_file:
|
||||
return os.path.join(temp_dir.name, "non_existing_config.yaml")
|
||||
|
||||
# Copy the config file over
|
||||
config_source = os.path.join(working_dir, "data", "configs", config_file)
|
||||
config_dest = os.path.join(temp_dir.name, config_file)
|
||||
|
@ -106,7 +110,6 @@ def we_use_the_config(config_file, temp_dir, working_dir):
|
|||
|
||||
|
||||
@given(parse('the config "{config_file}" exists'), target_fixture="config_path")
|
||||
@given('the config "<config_file>" exists', target_fixture="config_path")
|
||||
def config_exists(config_file, temp_dir, working_dir):
|
||||
config_source = os.path.join(working_dir, "data", "configs", config_file)
|
||||
config_dest = os.path.join(temp_dir.name, config_file)
|
||||
|
|
|
@ -49,3 +49,24 @@ def get_nested_val(dictionary, path, *default):
|
|||
if default:
|
||||
return default[0]
|
||||
raise
|
||||
|
||||
|
||||
# @see: https://stackoverflow.com/a/41599695/569146
|
||||
def spy_wrapper(wrapped_function):
|
||||
from unittest import mock
|
||||
|
||||
mock = mock.MagicMock()
|
||||
|
||||
def wrapper(self, *args, **kwargs):
|
||||
mock(*args, **kwargs)
|
||||
return wrapped_function(self, *args, **kwargs)
|
||||
|
||||
wrapper.mock = mock
|
||||
return wrapper
|
||||
|
||||
|
||||
def get_fixture(request, name, default=None):
|
||||
result = default
|
||||
if name in request.node.fixturenames:
|
||||
result = request.getfixturevalue(name)
|
||||
return result
|
||||
|
|
|
@ -30,38 +30,47 @@ def output_should_match(regex, cli_run):
|
|||
assert matches, f"\nRegex didn't match:\n{regex}\n{str(out)}\n{str(matches)}"
|
||||
|
||||
|
||||
@then(parse("the output should contain\n{expected_output}"))
|
||||
@then(parse('the output should contain "{expected_output}"'))
|
||||
@then('the output should contain "<expected_output>"')
|
||||
@then(parse("the {which_output_stream} output should contain\n{expected_output}"))
|
||||
@then(parse('the {which_output_stream} output should contain "{expected_output}"'))
|
||||
def output_should_contain(expected_output, which_output_stream, cli_run):
|
||||
@then(parse("the output {should_or_should_not} contain\n{expected_output}"))
|
||||
@then(parse('the output {should_or_should_not} contain "{expected_output}"'))
|
||||
@then(
|
||||
parse(
|
||||
"the {which_output_stream} output {should_or_should_not} contain\n{expected_output}"
|
||||
)
|
||||
)
|
||||
@then(
|
||||
parse(
|
||||
'the {which_output_stream} output {should_or_should_not} contain "{expected_output}"'
|
||||
)
|
||||
)
|
||||
def output_should_contain(
|
||||
expected_output, which_output_stream, cli_run, should_or_should_not
|
||||
):
|
||||
we_should = parse_should_or_should_not(should_or_should_not)
|
||||
|
||||
assert expected_output
|
||||
if which_output_stream is None:
|
||||
assert (expected_output in cli_run["stdout"]) or (
|
||||
expected_output in cli_run["stderr"]
|
||||
assert ((expected_output in cli_run["stdout"]) == we_should) or (
|
||||
(expected_output in cli_run["stderr"]) == we_should
|
||||
)
|
||||
|
||||
elif which_output_stream == "standard":
|
||||
assert expected_output in cli_run["stdout"]
|
||||
assert (expected_output in cli_run["stdout"]) == we_should
|
||||
|
||||
elif which_output_stream == "error":
|
||||
assert expected_output in cli_run["stderr"]
|
||||
assert (expected_output in cli_run["stderr"]) == we_should
|
||||
|
||||
else:
|
||||
assert expected_output in cli_run[which_output_stream]
|
||||
assert (expected_output in cli_run[which_output_stream]) == we_should
|
||||
|
||||
|
||||
@then(parse("the output should not contain\n{expected_output}"))
|
||||
@then(parse('the output should not contain "{expected_output}"'))
|
||||
@then('the output should not contain "<expected_output>"')
|
||||
def output_should_not_contain(expected_output, cli_run):
|
||||
assert expected_output not in cli_run["stdout"]
|
||||
|
||||
|
||||
@then(parse("the output should be\n{expected_output}"))
|
||||
@then(parse('the output should be "{expected_output}"'))
|
||||
@then('the output should be "<expected_output>"')
|
||||
def output_should_be(expected_output, cli_run):
|
||||
actual = cli_run["stdout"].strip()
|
||||
expected = expected_output.strip()
|
||||
|
@ -75,7 +84,6 @@ def output_should_be_empty(cli_run):
|
|||
|
||||
|
||||
@then(parse('the output should contain the date "{date}"'))
|
||||
@then('the output should contain the date "<date>"')
|
||||
def output_should_contain_date(date, cli_run):
|
||||
assert date and date in cli_run["stdout"]
|
||||
|
||||
|
@ -94,12 +102,6 @@ def output_should_be_columns_wide(cli_run, width):
|
|||
assert len(line) <= width
|
||||
|
||||
|
||||
@then(parse('we should see the message "{text}"'))
|
||||
def should_see_the_message(text, cli_run):
|
||||
out = cli_run["stderr"]
|
||||
assert text in out, [text, out]
|
||||
|
||||
|
||||
@then(
|
||||
parse(
|
||||
'the config for journal "{journal_name}" {should_or_should_not} contain "{some_yaml}"'
|
||||
|
@ -126,10 +128,7 @@ def config_var_on_disk(config_on_disk, journal_name, should_or_should_not, some_
|
|||
# `expected` objects formatted in yaml only compare one level deep
|
||||
actual_slice = {key: actual.get(key, None) for key in expected.keys()}
|
||||
|
||||
if we_should:
|
||||
assert expected == actual_slice
|
||||
else:
|
||||
assert expected != actual_slice
|
||||
assert (expected == actual_slice) == we_should
|
||||
|
||||
|
||||
@then(
|
||||
|
@ -160,10 +159,7 @@ def config_var_in_memory(
|
|||
# `expected` objects formatted in yaml only compare one level deep
|
||||
actual_slice = {key: get_nested_val(actual, key) for key in expected.keys()}
|
||||
|
||||
if we_should:
|
||||
assert expected == actual_slice
|
||||
else:
|
||||
assert expected != actual_slice
|
||||
assert (expected == actual_slice) == we_should
|
||||
|
||||
|
||||
@then("we should be prompted for a password")
|
||||
|
@ -355,10 +351,7 @@ def count_elements(number, item, cli_run):
|
|||
def count_editor_args(num_args, cli_run, editor_state, should_or_should_not):
|
||||
we_should = parse_should_or_should_not(should_or_should_not)
|
||||
|
||||
if we_should:
|
||||
assert cli_run["mocks"]["editor"].called
|
||||
else:
|
||||
assert not cli_run["mocks"]["editor"].called
|
||||
assert cli_run["mocks"]["editor"].called == we_should
|
||||
|
||||
if isinstance(num_args, int):
|
||||
assert len(editor_state["command"]) == int(num_args)
|
||||
|
@ -368,10 +361,7 @@ def count_editor_args(num_args, cli_run, editor_state, should_or_should_not):
|
|||
def stdin_prompt_called(cli_run, should_or_should_not):
|
||||
we_should = parse_should_or_should_not(should_or_should_not)
|
||||
|
||||
if we_should:
|
||||
assert cli_run["mocks"]["stdin"].called
|
||||
else:
|
||||
assert not cli_run["mocks"]["stdin"].called
|
||||
assert cli_run["mocks"]["stdin"].called == we_should
|
||||
|
||||
|
||||
@then(parse('the editor filename should end with "{suffix}"'))
|
||||
|
|
|
@ -3,14 +3,12 @@
|
|||
|
||||
from contextlib import ExitStack
|
||||
import os
|
||||
from unittest.mock import patch
|
||||
|
||||
from pytest_bdd import parsers
|
||||
from pytest_bdd import when
|
||||
from pytest_bdd.parsers import parse
|
||||
from pytest_bdd.parsers import re
|
||||
|
||||
from jrnl.cli import cli
|
||||
from jrnl.os_compat import split_args
|
||||
|
||||
|
||||
@when(parse('we change directory to "{directory_name}"'))
|
||||
|
@ -21,103 +19,38 @@ def when_we_change_directory(directory_name):
|
|||
os.chdir(directory_name)
|
||||
|
||||
|
||||
# These variables are used in the `@when(re(...))` section below
|
||||
command = '(?P<command>[^"]+)'
|
||||
input_method = "(?P<input_method>enter|pipe)"
|
||||
user_input = '(?P<user_input>[^"]+)'
|
||||
|
||||
|
||||
@when(parse('we run "jrnl {command}" and {input_method}\n{user_input}'))
|
||||
@when(
|
||||
parsers.re(
|
||||
'we run "jrnl (?P<command>[^"]+)" and (?P<input_method>enter|pipe) "(?P<user_input>[^"]+)"'
|
||||
)
|
||||
)
|
||||
@when(parse('we run "jrnl" and {input_method} "{user_input}"'))
|
||||
@when(re(f'we run "jrnl {command}" and {input_method} "{user_input}"'))
|
||||
@when(re(f'we run "jrnl" and {input_method} "{user_input}"'))
|
||||
@when(parse('we run "jrnl {command}"'))
|
||||
@when('we run "jrnl <command>"')
|
||||
@when('we run "jrnl"')
|
||||
def we_run(
|
||||
command,
|
||||
config_path,
|
||||
config_in_memory,
|
||||
user_input,
|
||||
cli_run,
|
||||
capsys,
|
||||
password,
|
||||
cache_dir,
|
||||
editor,
|
||||
keyring,
|
||||
input_method,
|
||||
mocks,
|
||||
):
|
||||
assert input_method in ["", "enter", "pipe"]
|
||||
is_tty = input_method != "pipe"
|
||||
def we_run_jrnl(cli_run, capsys, keyring):
|
||||
from keyring import set_keyring
|
||||
|
||||
if cache_dir["exists"]:
|
||||
command = command.format(cache_dir=cache_dir["path"])
|
||||
|
||||
args = split_args(command)
|
||||
status = 0
|
||||
|
||||
if user_input:
|
||||
user_input = user_input.splitlines() if is_tty else [user_input]
|
||||
|
||||
if password:
|
||||
password = password.splitlines()
|
||||
|
||||
if not password and user_input:
|
||||
password = user_input
|
||||
set_keyring(keyring)
|
||||
|
||||
with ExitStack() as stack:
|
||||
# Always mock
|
||||
from jrnl.override import apply_overrides
|
||||
mocks = cli_run["mocks"]
|
||||
factories = cli_run["mock_factories"]
|
||||
|
||||
def my_overrides(*args, **kwargs):
|
||||
result = apply_overrides(*args, **kwargs)
|
||||
config_in_memory["overrides"] = result
|
||||
return result
|
||||
|
||||
stack.enter_context(
|
||||
patch("jrnl.jrnl.apply_overrides", side_effect=my_overrides)
|
||||
)
|
||||
|
||||
# Conditionally mock
|
||||
stack.enter_context(patch("sys.argv", ["jrnl"] + args))
|
||||
|
||||
mock_stdin = stack.enter_context(
|
||||
patch("sys.stdin.read", side_effect=user_input)
|
||||
)
|
||||
stack.enter_context(patch("sys.stdin.isatty", return_value=is_tty))
|
||||
mock_input = stack.enter_context(
|
||||
patch("builtins.input", side_effect=user_input)
|
||||
)
|
||||
mock_getpass = stack.enter_context(
|
||||
patch("getpass.getpass", side_effect=password)
|
||||
)
|
||||
|
||||
if "datetime" in mocks:
|
||||
stack.enter_context(mocks["datetime"])
|
||||
stack.enter_context(mocks["calendar_parse"])
|
||||
|
||||
stack.enter_context(
|
||||
patch("jrnl.install.get_config_path", return_value=config_path)
|
||||
)
|
||||
stack.enter_context(
|
||||
patch("jrnl.config.get_config_path", return_value=config_path)
|
||||
)
|
||||
mock_editor = stack.enter_context(patch("subprocess.call", side_effect=editor))
|
||||
for id in factories:
|
||||
mocks[id] = stack.enter_context(factories[id]())
|
||||
|
||||
try:
|
||||
cli(args)
|
||||
cli()
|
||||
except StopIteration:
|
||||
# This happens when input is expected, but don't have any input left
|
||||
pass
|
||||
except SystemExit as e:
|
||||
status = e.code
|
||||
cli_run["status"] = e.code
|
||||
|
||||
captured = capsys.readouterr()
|
||||
|
||||
cli_run["status"] = status
|
||||
cli_run["stdout"] = captured.out
|
||||
cli_run["stderr"] = captured.err
|
||||
cli_run["mocks"] = {
|
||||
"stdin": mock_stdin,
|
||||
"input": mock_input,
|
||||
"getpass": mock_getpass,
|
||||
"editor": mock_editor,
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue