mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Compare commits
No commits in common. "develop" and "v4.2-beta" have entirely different histories.
32 changed files with 355 additions and 823 deletions
2
.github/actions/run_tests/action.yaml
vendored
2
.github/actions/run_tests/action.yaml
vendored
|
@ -34,7 +34,7 @@ runs:
|
|||
echo '::endgroup::'
|
||||
|
||||
echo '::group::Other dependencies'
|
||||
poetry sync
|
||||
poetry install --remove-untracked
|
||||
echo '::endgroup::'
|
||||
|
||||
echo 'DEPS_INSTALLED=true' >> $GITHUB_ENV
|
||||
|
|
2
.github/workflows/docs.yaml
vendored
2
.github/workflows/docs.yaml
vendored
|
@ -65,7 +65,7 @@ jobs:
|
|||
run: |
|
||||
pip install poetry
|
||||
poetry config --local virtualenvs.in-project true
|
||||
poetry sync --no-root
|
||||
poetry install --no-root --remove-untracked
|
||||
npm install
|
||||
echo "node_modules/.bin" >> "$GITHUB_PATH"
|
||||
|
||||
|
|
115
.github/workflows/release.yaml
vendored
115
.github/workflows/release.yaml
vendored
|
@ -19,6 +19,11 @@ on:
|
|||
type: boolean
|
||||
required: true
|
||||
default: true
|
||||
include_brew:
|
||||
description: 'Publish to Homebrew?'
|
||||
type: boolean
|
||||
required: true
|
||||
default: true
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
|
@ -63,7 +68,7 @@ jobs:
|
|||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.13'
|
||||
python-version: '3.12'
|
||||
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
@ -107,3 +112,111 @@ jobs:
|
|||
run: |
|
||||
pypi_version="$(find dist/jrnl-*.tar.gz | sed -r 's!dist/jrnl-(.*)\.tar\.gz!\1!')"
|
||||
echo "pypi_version=$pypi_version" >> "$GITHUB_OUTPUT"
|
||||
|
||||
release_homebrew:
|
||||
if: ${{ github.event.inputs.include_brew == 'true' }}
|
||||
needs: release_pypi
|
||||
name: "Release to Homebrew"
|
||||
runs-on: macos-latest
|
||||
env:
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
HOME_REPO: ${{ secrets.HOME_REPO }}
|
||||
steps:
|
||||
- name: Get version
|
||||
run: |
|
||||
JRNL_VERSION="${{ github.event.inputs.version }}"
|
||||
PYPI_VERSION="${{ needs.release_pypi.outputs.pypi_version }}"
|
||||
|
||||
echo "::debug::jrnl version: $JRNL_VERSION"
|
||||
echo "::debug::pypi version: $PYPI_VERSION"
|
||||
|
||||
echo "JRNL_VERSION=$JRNL_VERSION" >> "$GITHUB_ENV"
|
||||
echo "PYPI_VERSION=$PYPI_VERSION" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Set env variables
|
||||
env:
|
||||
REPO_OWNER: ${{ github.repository_owner }}
|
||||
run: |
|
||||
if [[ $JRNL_VERSION =~ (alpha|beta) ]]; then
|
||||
echo '::debug::Prerelease (not a full release)'
|
||||
{
|
||||
echo "RELEASE_TYPE=pre"
|
||||
echo "FORMULA_REPO=${REPO_OWNER}/homebrew-prerelease"
|
||||
echo "BOT_REPO=jrnl-bot/homebrew-prerelease"
|
||||
echo "FORMULA_NAME=jrnl-beta"
|
||||
} >> "$GITHUB_ENV"
|
||||
else
|
||||
echo '::debug::Full release (not a prerelease)'
|
||||
if [[ "${{ github.repository }}" == "${HOME_REPO}" ]]; then
|
||||
REPO_OWNER="homebrew"
|
||||
fi
|
||||
{
|
||||
echo "RELEASE_TYPE=full"
|
||||
echo "FORMULA_REPO=${REPO_OWNER}/homebrew-core"
|
||||
echo "BOT_REPO=jrnl-bot/homebrew-core"
|
||||
echo "FORMULA_NAME=jrnl"
|
||||
} >> "$GITHUB_ENV"
|
||||
fi
|
||||
|
||||
- name: Tap formula
|
||||
run: |
|
||||
brew tap "${FORMULA_REPO}"
|
||||
echo '::debug::Set tap directory'
|
||||
echo "BREW_TAP_DIRECTORY=$(brew --repo "${FORMULA_REPO}")" >> "$GITHUB_ENV"
|
||||
- name: Install dependencies
|
||||
run: brew install pipgrip
|
||||
|
||||
- name: Query PyPI API
|
||||
uses: nick-invision/retry@v3
|
||||
with:
|
||||
timeout_seconds: 10
|
||||
max_attempts: 30
|
||||
retry_wait_seconds: 10
|
||||
command: |
|
||||
curl -Ls https://pypi.org/pypi/jrnl/json > api_response.json
|
||||
# if query doesn't have our version yet, give it some time before trying again
|
||||
if [[ "null" == "$(jq ".releases[\"${PYPI_VERSION}\"][1].url" -r api_response.json)" ]]; then
|
||||
echo "::debug::PYPI_VERSION: $PYPI_VERSION"
|
||||
echo "::debug::JQ VALUE: $(jq ".releases[\"${PYPI_VERSION}\"][1].url" -r api_response.json)"
|
||||
echo "::group::cat api_response.json"
|
||||
cat api_response.json
|
||||
echo "::endgroup::"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Update Homebrew Formula
|
||||
uses: nick-invision/retry@v3
|
||||
with:
|
||||
timeout_minutes: 8
|
||||
max_attempts: 6
|
||||
retry_wait_seconds: 30
|
||||
command: >
|
||||
brew bump-formula-pr "${FORMULA_NAME}"
|
||||
--url $(jq ".releases[\"${PYPI_VERSION}\"][1].url" -r api_response.json)
|
||||
--sha256 $(jq ".releases[\"${PYPI_VERSION}\"][1].digests.sha256" -r api_response.json)
|
||||
--no-audit
|
||||
--write-only
|
||||
--force
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
with:
|
||||
path: ${{ env.BREW_TAP_DIRECTORY }}
|
||||
token: ${{ secrets.JRNL_BOT_TOKEN }}
|
||||
push-to-fork: ${{ env.BOT_REPO }}
|
||||
|
||||
committer: ${{ secrets.JRNL_BOT_NAME }} <${{ secrets.JRNL_BOT_EMAIL }}>
|
||||
author: ${{ secrets.JRNL_BOT_NAME }} <${{ secrets.JRNL_BOT_EMAIL }}>
|
||||
|
||||
title: jrnl ${{ env.JRNL_VERSION }}
|
||||
body: Created with `brew bump-formula-pr`
|
||||
|
||||
branch: jrnl-${{ env.JRNL_VERSION }}--
|
||||
branch-suffix: random
|
||||
commit-message: |
|
||||
jrnl ${{ env.JRNL_VERSION }}
|
||||
|
||||
Update jrnl to ${{ env.JRNL_VERSION }}
|
||||
|
||||
${{ secrets.RELEASE_COAUTHORS }}
|
||||
|
|
50
CHANGELOG.md
50
CHANGELOG.md
|
@ -2,55 +2,7 @@
|
|||
|
||||
## [Unreleased](https://github.com/jrnl-org/jrnl/)
|
||||
|
||||
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v4.2.1...HEAD)
|
||||
|
||||
**Fixed bugs:**
|
||||
|
||||
- poetry warning - "poetry.dev-dependencies" section is deprecated [\#1975](https://github.com/jrnl-org/jrnl/issues/1975)
|
||||
- Homebrew autobump error on jrnl release [\#1961](https://github.com/jrnl-org/jrnl/issues/1961)
|
||||
|
||||
**Build:**
|
||||
|
||||
- Remove release step to publish to Homebrew [\#1994](https://github.com/jrnl-org/jrnl/pull/1994) ([micahellison](https://github.com/micahellison))
|
||||
|
||||
**Packaging:**
|
||||
|
||||
- Update dependency rich to v14 [\#1989](https://github.com/jrnl-org/jrnl/pull/1989) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update dependency python to 3.13 [\#1988](https://github.com/jrnl-org/jrnl/pull/1988) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update dependency tox to v4.25.0 [\#1986](https://github.com/jrnl-org/jrnl/pull/1986) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update dependency tzlocal to v5.3.1 [\#1984](https://github.com/jrnl-org/jrnl/pull/1984) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update dependency jinja2 to v3.1.6 [\#1983](https://github.com/jrnl-org/jrnl/pull/1983) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update dependency poethepoet to v0.33.1 [\#1982](https://github.com/jrnl-org/jrnl/pull/1982) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update dependency pytest to v8.3.5 [\#1981](https://github.com/jrnl-org/jrnl/pull/1981) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update dependency cryptography to v44.0.2 [\#1980](https://github.com/jrnl-org/jrnl/pull/1980) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update dependency ruff to v0.11.3 [\#1978](https://github.com/jrnl-org/jrnl/pull/1978) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
|
||||
## [v4.2.1](https://pypi.org/project/jrnl/v4.2.1/) (2025-02-25)
|
||||
|
||||
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v4.2...v4.2.1)
|
||||
|
||||
**Documentation:**
|
||||
|
||||
- Typing animation in landing page is broken [\#1969](https://github.com/jrnl-org/jrnl/issues/1969)
|
||||
|
||||
**Packaging:**
|
||||
|
||||
- Update dependency pytest to \>=8.1.1 [\#1974](https://github.com/jrnl-org/jrnl/pull/1974) ([wren](https://github.com/wren))
|
||||
- Update dependency black to v25 [\#1973](https://github.com/jrnl-org/jrnl/pull/1973) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update dependency tzlocal to v5.3 [\#1972](https://github.com/jrnl-org/jrnl/pull/1972) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update dependency ruamel.yaml to v0.18.10 [\#1967](https://github.com/jrnl-org/jrnl/pull/1967) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update dependency jinja2 to v3.1.5 [\#1966](https://github.com/jrnl-org/jrnl/pull/1966) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update dependency cryptography to v44 [\#1962](https://github.com/jrnl-org/jrnl/pull/1962) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update dependency pytest-bdd to v8.1.0 [\#1952](https://github.com/jrnl-org/jrnl/pull/1952) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update dependency poethepoet to v0.32.2 [\#1951](https://github.com/jrnl-org/jrnl/pull/1951) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update dependency keyring to v25.6.0 [\#1948](https://github.com/jrnl-org/jrnl/pull/1948) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update dependency ruff to v0.9.7 [\#1947](https://github.com/jrnl-org/jrnl/pull/1947) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update dependency rich to v13.9.4 [\#1946](https://github.com/jrnl-org/jrnl/pull/1946) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
- Update dependency tox to v4.24.1 [\#1945](https://github.com/jrnl-org/jrnl/pull/1945) ([renovate[bot]](https://github.com/apps/renovate))
|
||||
|
||||
## [v4.2](https://pypi.org/project/jrnl/v4.2/) (2024-11-17)
|
||||
|
||||
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v4.2-beta...v4.2)
|
||||
[Full Changelog](https://github.com/jrnl-org/jrnl/compare/v4.1...HEAD)
|
||||
|
||||
**Implemented enhancements:**
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ License: https://www.gnu.org/licenses/gpl-3.0.html
|
|||
<footer>
|
||||
jrnl is made with love by <a href="https://github.com/jrnl-org/jrnl/graphs/contributors" title="Contributors">many fabulous people</a>. If you need help, <a href="https://github.com/jrnl-org/jrnl/issues/new/choose" title="Open a new issue on Github">submit an issue</a> on Github.
|
||||
</footer>
|
||||
<script src="https://unpkg.com/typed.js@2.1.0/dist/typed.umd.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/typed.js/2.1.0/typed.min.js"></script>
|
||||
<script>
|
||||
new Typed("#typed", {
|
||||
strings: [
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
mkdocs>=1.4
|
||||
jinja2==3.1.6
|
||||
jinja2==3.1.4
|
||||
|
|
|
@ -1 +1 @@
|
|||
__version__ = "v4.2.1"
|
||||
__version__ = "v4.2-beta"
|
||||
|
|
|
@ -76,17 +76,7 @@ def postconfig_import(args: argparse.Namespace, config: dict, **_) -> int:
|
|||
journal = open_journal(args.journal_name, config)
|
||||
|
||||
format = args.export if args.export else "jrnl"
|
||||
|
||||
if (importer := get_importer(format)) is None:
|
||||
raise JrnlException(
|
||||
Message(
|
||||
MsgText.ImporterNotFound,
|
||||
MsgStyle.ERROR,
|
||||
{"format": format},
|
||||
)
|
||||
)
|
||||
|
||||
importer.import_(journal, args.filename)
|
||||
get_importer(format).import_(journal, args.filename)
|
||||
|
||||
return 0
|
||||
|
||||
|
|
|
@ -266,11 +266,6 @@ class MsgText(Enum):
|
|||
{count} imported to {journal_name} journal
|
||||
"""
|
||||
|
||||
ImporterNotFound = """
|
||||
No importer found for file type '{format}'.
|
||||
'{format}' is likely to be an export-only format.
|
||||
"""
|
||||
|
||||
# --- Color --- #
|
||||
InvalidColor = "{key} set to invalid color: {color}"
|
||||
|
||||
|
|
484
poetry.lock
generated
484
poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "jrnl"
|
||||
version = "v4.2.1"
|
||||
version = "v4.2-beta"
|
||||
description = "Collect your thoughts and notes without leaving the command line."
|
||||
authors = [
|
||||
"jrnl contributors <maintainers@jrnl.sh>",
|
||||
|
@ -36,19 +36,19 @@ parsedatetime = ">=2.6"
|
|||
python-dateutil = "^2.8" # https://github.com/dateutil/dateutil/blob/master/RELEASING
|
||||
pyxdg = ">=0.27.0"
|
||||
"ruamel.yaml" = ">=0.17.22"
|
||||
rich = ">=14.0.0, <14.1.0"
|
||||
rich = ">=12.2.0, <14.0.0"
|
||||
|
||||
# dayone-only deps
|
||||
tzlocal = ">=4.0" # https://github.com/regebro/tzlocal/blob/master/CHANGES.txt
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
[tool.poetry.dev-dependencies]
|
||||
black = { version = ">=21.5b2", allow-prereleases = true }
|
||||
ipdb = "*"
|
||||
mkdocs = ">=1.4"
|
||||
parse-type = ">=0.6.0"
|
||||
poethepoet = "*"
|
||||
pytest = ">=8.1"
|
||||
pytest-bdd = ">=8.0"
|
||||
pytest = ">=6.2,<=8.1"
|
||||
pytest-bdd = ">=6.0"
|
||||
pytest-clarity = "*"
|
||||
pytest-xdist = ">=2.5.0"
|
||||
requests = "*"
|
||||
|
@ -169,8 +169,8 @@ isolated_build = True
|
|||
|
||||
[testenv]
|
||||
deps =
|
||||
pytest >=8.1
|
||||
pytest-bdd >=8.0
|
||||
pytest >=6.2,<=8.1
|
||||
pytest-bdd >=6.0
|
||||
pytest-xdist >=2.5.0
|
||||
parse-type >=0.6.0
|
||||
toml >=0.10
|
||||
|
|
|
@ -8,20 +8,16 @@ Feature: Test combinations of edit, change-time, and delete
|
|||
And we write nothing to the editor if opened
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --change-time '2022-04-23 10:30' --edit" and enter
|
||||
"""
|
||||
Y
|
||||
N
|
||||
Y
|
||||
"""
|
||||
Then the error output should contain "No text received from editor. Were you trying to delete all the entries?"
|
||||
And the editor should have been called
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2022-04-23 10:30 Entry the first.
|
||||
2022-04-23 10:30 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -33,16 +29,12 @@ Feature: Test combinations of edit, change-time, and delete
|
|||
Scenario Outline: --delete with --edit deletes selected entries
|
||||
Given we use the config "<config_file>"
|
||||
And we append to the editor if opened
|
||||
"""
|
||||
[2023-02-21 10:32] Here is a new entry
|
||||
"""
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --delete --edit" and enter
|
||||
"""
|
||||
Y
|
||||
N
|
||||
Y
|
||||
"""
|
||||
Then the editor should have been called
|
||||
And the error output should contain "3 entries found"
|
||||
And the error output should contain "2 entries deleted"
|
||||
|
@ -50,10 +42,8 @@ Feature: Test combinations of edit, change-time, and delete
|
|||
When we run "jrnl -99 --short"
|
||||
Then the error output should contain "2 entries found"
|
||||
And the output should be
|
||||
"""
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2023-02-21 10:32 Here is a new entry
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -67,23 +57,19 @@ Feature: Test combinations of edit, change-time, and delete
|
|||
And we use the password "test" if prompted
|
||||
# --change-time is asked first, then --delete
|
||||
When we run "jrnl --change-time '2022-04-23 10:30' --delete" and enter
|
||||
"""
|
||||
N
|
||||
N
|
||||
Y
|
||||
Y
|
||||
N
|
||||
N
|
||||
"""
|
||||
Then the error output should contain "3 entries found"
|
||||
And the error output should contain "1 entry deleted"
|
||||
And the error output should contain "1 entry modified"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2022-04-23 10:30 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -95,30 +81,24 @@ Feature: Test combinations of edit, change-time, and delete
|
|||
Scenario Outline: Combining --change-time and --delete and --edit affects appropriate entries
|
||||
Given we use the config "<config_file>"
|
||||
And we append to the editor if opened
|
||||
"""
|
||||
[2023-02-21 10:32] Here is a new entry
|
||||
"""
|
||||
[2023-02-21 10:32] Here is a new entry
|
||||
And we use the password "test" if prompted
|
||||
# --change-time is asked first, then --delete, then --edit
|
||||
When we run "jrnl --change-time '2022-04-23 10:30' --delete --edit" and enter
|
||||
"""
|
||||
N
|
||||
Y
|
||||
Y
|
||||
Y
|
||||
Y
|
||||
N
|
||||
"""
|
||||
Then the error output should contain "3 entries found"
|
||||
And the error output should contain "2 entries deleted"
|
||||
And the error output should contain "1 entry modified"
|
||||
And the error output should contain "1 entry added"
|
||||
And the error output should contain "1 entry modified" # only 1, because the other was deleted
|
||||
And the error output should contain "1 entry added" # by edit
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2022-04-23 10:30 The third entry finally after weeks without writing.
|
||||
2023-02-21 10:32 Here is a new entry
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
|
|
@ -8,18 +8,14 @@ Feature: Change entry times in journal
|
|||
When we run "jrnl -1"
|
||||
Then the output should contain "2020-09-24 09:14 The third entry finally"
|
||||
When we run "jrnl -1 --change-time '2022-04-23 10:30'" and enter
|
||||
"""
|
||||
Y
|
||||
"""
|
||||
Then the error output should contain "1 entry modified"
|
||||
And the error output should not contain "deleted"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2022-04-23 10:30 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -33,26 +29,20 @@ Feature: Change entry times in journal
|
|||
And we use the password "test" if prompted
|
||||
When we run "jrnl --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
"""
|
||||
When we run "jrnl --change-time '2022-04-23 10:30'" and enter
|
||||
"""
|
||||
Y
|
||||
N
|
||||
Y
|
||||
"""
|
||||
Then the error output should contain "3 entries found"
|
||||
And the error output should contain "2 entries modified"
|
||||
When we run "jrnl --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2022-04-23 10:30 Entry the first.
|
||||
2022-04-23 10:30 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -68,18 +58,14 @@ Feature: Change entry times in journal
|
|||
When we run "jrnl -1"
|
||||
Then the output should contain "2020-09-24 09:14 The third entry finally"
|
||||
When we run "jrnl -1 --change-time '2023-02-21 10:30'" and enter
|
||||
"""
|
||||
N
|
||||
"""
|
||||
Then the error output should not contain "modified"
|
||||
And the error output should not contain "deleted"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -97,11 +83,9 @@ Feature: Change entry times in journal
|
|||
And the error output should not contain "entries deleted"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -115,18 +99,14 @@ Feature: Change entry times in journal
|
|||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --change-time '2022-04-23 10:30' @ipsum" and enter
|
||||
"""
|
||||
Y
|
||||
"""
|
||||
Then the error output should contain "1 entry found"
|
||||
And the error output should contain "1 entry modified"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
2022-04-23 10:30 Entry the first.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -140,17 +120,13 @@ Feature: Change entry times in journal
|
|||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --change-time '2022-04-23 10:30' @ipsum @tagthree" and enter
|
||||
"""
|
||||
Y
|
||||
Y
|
||||
"""
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2022-04-23 10:30 Entry the first.
|
||||
2022-04-23 10:30 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -164,16 +140,12 @@ Feature: Change entry times in journal
|
|||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --change-time '2022-04-23 10:30' -and @tagone @tagtwo" and enter
|
||||
"""
|
||||
Y
|
||||
"""
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
2022-04-23 10:30 Entry the first.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -187,16 +159,12 @@ Feature: Change entry times in journal
|
|||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --change-time '2022-04-23 10:30' @tagone -not @ipsum" and enter
|
||||
"""
|
||||
Y
|
||||
"""
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2022-04-23 10:30 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -210,16 +178,12 @@ Feature: Change entry times in journal
|
|||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --change-time '2022-04-23 10:30' -from 2020-09-01" and enter
|
||||
"""
|
||||
Y
|
||||
"""
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2022-04-23 10:30 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -233,17 +197,13 @@ Feature: Change entry times in journal
|
|||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --change-time '2022-04-23 10:30' -to 2020-08-31" and enter
|
||||
"""
|
||||
Y
|
||||
Y
|
||||
"""
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
2022-04-23 10:30 Entry the first.
|
||||
2022-04-23 10:30 A second entry in what I hope to be a long series.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -257,16 +217,12 @@ Feature: Change entry times in journal
|
|||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --change-time '2022-04-23 10:30' -starred" and enter
|
||||
"""
|
||||
Y
|
||||
"""
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
2022-04-23 10:30 A second entry in what I hope to be a long series.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -280,17 +236,13 @@ Feature: Change entry times in journal
|
|||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --change-time '2022-04-23 10:30' -contains dignissim" and enter
|
||||
"""
|
||||
Y
|
||||
"""
|
||||
Then the error output should contain "1 entry modified"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
2022-04-23 10:30 Entry the first.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -304,18 +256,14 @@ Feature: Change entry times in journal
|
|||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --change-time" and enter
|
||||
"""
|
||||
N
|
||||
N
|
||||
N
|
||||
"""
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
|
|
@ -7,8 +7,8 @@ Feature: Multiple journals
|
|||
Given the config "basic_onefile.yaml" exists
|
||||
And we use the config "multiple.yaml"
|
||||
When we run "jrnl --cf basic_onefile.yaml -999"
|
||||
Then the output should not contain "My first entry"
|
||||
And the output should contain "Lorem ipsum"
|
||||
Then the output should not contain "My first entry" # from multiple.yaml
|
||||
And the output should contain "Lorem ipsum" # from basic_onefile.yaml
|
||||
|
||||
Scenario: Write to default journal by default using an alternate config
|
||||
Given the config "multiple.yaml" exists
|
||||
|
@ -73,22 +73,18 @@ Feature: Multiple journals
|
|||
Given the config "multiple.yaml" exists
|
||||
And we use the config "basic_onefile.yaml"
|
||||
When we run "jrnl new_encrypted --cf multiple.yaml Adding first entry" and enter
|
||||
"""
|
||||
these three eyes
|
||||
these three eyes
|
||||
n
|
||||
"""
|
||||
Then the output should contain "Journal 'new_encrypted' created at "
|
||||
|
||||
Scenario: Don't overwrite main config when encrypting a journal in an alternate config
|
||||
Given the config "basic_onefile.yaml" exists
|
||||
And we use the config "multiple.yaml"
|
||||
When we run "jrnl --cf basic_onefile.yaml --encrypt" and enter
|
||||
"""
|
||||
these three eyes
|
||||
these three eyes
|
||||
n
|
||||
"""
|
||||
Then the output should contain "Journal encrypted to features/journals/basic_onefile.journal"
|
||||
And the config should contain "encrypt: false"
|
||||
|
||||
|
|
|
@ -27,13 +27,11 @@ Feature: Reading and writing to journal with custom date formats
|
|||
Then we should get no error
|
||||
When we run "jrnl -n 999"
|
||||
Then the output should be
|
||||
"""
|
||||
09.06.2013 15:39 My first entry.
|
||||
| Everything is alright
|
||||
|
||||
10.07.2013 15:40 Life is good.
|
||||
| But I'm better.
|
||||
"""
|
||||
|
||||
|
||||
Scenario Outline: Writing an entry from command line with custom date
|
||||
|
@ -144,11 +142,9 @@ Feature: Reading and writing to journal with custom date formats
|
|||
Given we use the config "mostlyreadabledates.yaml"
|
||||
When we run "jrnl --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2019-07-01 14:23 The third entry
|
||||
2019-07-18 14:23 The first entry
|
||||
2019-07-19 14:23 The second entry
|
||||
"""
|
||||
|
||||
|
||||
Scenario: Update near-valid dates after journal is edited
|
||||
|
@ -179,9 +175,7 @@ Feature: Reading and writing to journal with custom date formats
|
|||
When we run "jrnl -1"
|
||||
Then we should get no error
|
||||
And the output should be
|
||||
"""
|
||||
2013-10-27 04:27 Some text.
|
||||
"""
|
||||
|
||||
|
||||
@skip #1422
|
||||
|
|
|
@ -8,19 +8,15 @@ Feature: Delete entries from journal
|
|||
When we run "jrnl -1"
|
||||
Then the output should contain "2020-09-24 09:14 The third entry finally"
|
||||
When we run "jrnl --delete" and enter
|
||||
"""
|
||||
N
|
||||
N
|
||||
Y
|
||||
"""
|
||||
Then the error output should contain "3 entries found"
|
||||
And the error output should contain "1 entry deleted"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -33,17 +29,13 @@ Feature: Delete entries from journal
|
|||
Scenario Outline: Backing out of interactive delete does not change journal
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --delete -n 1" and enter
|
||||
"""
|
||||
N
|
||||
"""
|
||||
Then the error output should not contain "deleted"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -58,11 +50,9 @@ Feature: Delete entries from journal
|
|||
Then the error output should contain "No entries to delete"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -74,17 +64,13 @@ Feature: Delete entries from journal
|
|||
Scenario Outline: Delete flag with tag only deletes tagged entries
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --delete @ipsum" and enter
|
||||
"""
|
||||
Y
|
||||
"""
|
||||
Then the error output should contain "1 entry found"
|
||||
Then the error output should contain "1 entry deleted"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -96,17 +82,13 @@ Feature: Delete entries from journal
|
|||
Scenario Outline: Delete flag with multiple tags deletes all entries matching any of the tags
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --delete @ipsum @tagthree" and enter
|
||||
"""
|
||||
Y
|
||||
Y
|
||||
"""
|
||||
Then the error output should contain "2 entries found"
|
||||
And the error output should contain "2 entries deleted"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -118,17 +100,13 @@ Feature: Delete entries from journal
|
|||
Scenario Outline: Delete flag with -and deletes boolean AND of tagged entries
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --delete -and @tagone @tagtwo" and enter
|
||||
"""
|
||||
Y
|
||||
"""
|
||||
Then the error output should contain "1 entry found"
|
||||
And the error output should contain "1 entry deleted"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -140,17 +118,13 @@ Feature: Delete entries from journal
|
|||
Scenario Outline: Delete flag with -not does not delete entries from given tag
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --delete @tagone -not @ipsum" and enter
|
||||
"""
|
||||
Y
|
||||
"""
|
||||
Then the error output should contain "1 entry found"
|
||||
And the error output should contain "1 entry deleted"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -162,17 +136,13 @@ Feature: Delete entries from journal
|
|||
Scenario Outline: Delete flag with -from search operator only deletes entries since that date
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --delete -from 2020-09-01" and enter
|
||||
"""
|
||||
Y
|
||||
"""
|
||||
Then the error output should contain "1 entry found"
|
||||
And the error output should contain "1 entry deleted"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -184,17 +154,13 @@ Feature: Delete entries from journal
|
|||
Scenario Outline: Delete flag with -to only deletes entries up to specified date
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --delete -to 2020-08-31" and enter
|
||||
"""
|
||||
Y
|
||||
Y
|
||||
"""
|
||||
Then the error output should contain "2 entries found"
|
||||
And the error output should contain "2 entries deleted"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -206,16 +172,12 @@ Feature: Delete entries from journal
|
|||
Scenario Outline: Delete flag with -starred only deletes starred entries
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --delete -starred" and enter
|
||||
"""
|
||||
Y
|
||||
"""
|
||||
Then the error output should contain "1 entry deleted"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
@ -227,17 +189,13 @@ Feature: Delete entries from journal
|
|||
Scenario Outline: Delete flag with -contains only entries containing expression
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --delete -contains dignissim" and enter
|
||||
"""
|
||||
Y
|
||||
"""
|
||||
Then the error output should contain "1 entry found"
|
||||
And the error output should contain "1 entry deleted"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: Configs
|
||||
| config_file |
|
||||
|
|
|
@ -11,10 +11,8 @@ Feature: Encrypting and decrypting journals
|
|||
And the config for journal "default" should contain "encrypt: false"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
"""
|
||||
|
||||
|
||||
@todo
|
||||
|
@ -25,10 +23,8 @@ Feature: Encrypting and decrypting journals
|
|||
Then the config for journal "default" should contain "encrypt: false"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
"""
|
||||
|
||||
|
||||
Scenario: Trying to encrypt an already encrypted journal
|
||||
|
@ -40,11 +36,9 @@ Feature: Encrypting and decrypting journals
|
|||
Scenario Outline: Encrypting a journal
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl --encrypt" and enter
|
||||
"""
|
||||
swordfish
|
||||
swordfish
|
||||
n
|
||||
"""
|
||||
Then we should get no error
|
||||
And the output should contain "Journal encrypted"
|
||||
And the config for journal "default" should contain "encrypt: true"
|
||||
|
@ -56,20 +50,16 @@ Feature: Encrypting and decrypting journals
|
|||
Given we use the config "simple.yaml"
|
||||
And we don't have a keyring
|
||||
When we run "jrnl --encrypt" and enter
|
||||
"""
|
||||
swordfish
|
||||
swordfish
|
||||
y
|
||||
"""
|
||||
Then we should get no error
|
||||
And the output should contain "Journal encrypted"
|
||||
When we run "jrnl --encrypt" and enter
|
||||
"""
|
||||
swordfish
|
||||
tuna
|
||||
tuna
|
||||
y
|
||||
"""
|
||||
Then we should get no error
|
||||
And the output should contain "Journal default is already encrypted. Create a new password."
|
||||
And we should be prompted for a password
|
||||
|
@ -79,19 +69,15 @@ Feature: Encrypting and decrypting journals
|
|||
Given we use the config "simple.yaml"
|
||||
And we have a keyring
|
||||
When we run "jrnl --encrypt" and enter
|
||||
"""
|
||||
swordfish
|
||||
swordfish
|
||||
y
|
||||
"""
|
||||
Then we should get no error
|
||||
And the output should contain "Journal encrypted"
|
||||
When we run "jrnl --encrypt" and enter
|
||||
"""
|
||||
tuna
|
||||
tuna
|
||||
y
|
||||
"""
|
||||
Then we should get no error
|
||||
And the output should contain "Journal default is already encrypted. Create a new password."
|
||||
And we should be prompted for a password
|
||||
|
|
|
@ -8,9 +8,7 @@ Feature: Journals iteracting with the file system in a way that users can see
|
|||
When we run "jrnl 23 July 2013: Testing folder journal."
|
||||
Then we should get no error
|
||||
And the journal directory should contain
|
||||
"""
|
||||
2013/07/23.txt
|
||||
"""
|
||||
|
||||
Scenario: Adding multiple entries to a Folder journal should generate multiple date files
|
||||
Given we use the config "empty_folder.yaml"
|
||||
|
@ -18,9 +16,7 @@ Feature: Journals iteracting with the file system in a way that users can see
|
|||
And we run "jrnl 3/7/2014: Second entry of journal."
|
||||
Then we should get no error
|
||||
And the journal directory should contain
|
||||
"""
|
||||
2013/07/23.txt
|
||||
"""
|
||||
|
||||
Scenario: If the journal and its parent directory don't exist, they should be created
|
||||
Given we use the config "missing_directory.yaml"
|
||||
|
@ -59,11 +55,9 @@ Feature: Journals iteracting with the file system in a way that users can see
|
|||
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
|
||||
\n
|
||||
"""
|
||||
Then the output should contain "Journal 'default' created"
|
||||
When we change directory to "subfolder"
|
||||
And we run "jrnl -n 1"
|
||||
|
|
|
@ -40,12 +40,10 @@ Feature: Custom formats
|
|||
Given we parse the output as JSON
|
||||
Then "entries" in the parsed output should have 3 elements
|
||||
And "tags" in the parsed output should be
|
||||
"""
|
||||
@ipsum
|
||||
@tagone
|
||||
@tagtwo
|
||||
@tagthree
|
||||
"""
|
||||
And "entries.0.tags" in the parsed output should have 3 elements
|
||||
And "entries.1.tags" in the parsed output should have 1 elements
|
||||
And "entries.2.tags" in the parsed output should have 2 elements
|
||||
|
@ -64,9 +62,7 @@ Feature: Custom formats
|
|||
And the output should be valid JSON
|
||||
Given we parse the output as JSON
|
||||
Then "entries.0.uuid" in the parsed output should be
|
||||
"""
|
||||
4BB1F46946AD439996C9B59DE7C4DDC1
|
||||
"""
|
||||
|
||||
Scenario Outline: Printing a journal that has multiline entries with tags
|
||||
Given we use the config "<config_file>"
|
||||
|
@ -74,7 +70,6 @@ Feature: Custom formats
|
|||
When we run "jrnl -n 1 @ipsum"
|
||||
Then we should get no error
|
||||
And the output should be
|
||||
"""
|
||||
2020-08-29 11:11 Entry the first.
|
||||
| Lorem @ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada
|
||||
| quis est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus
|
||||
|
@ -95,7 +90,6 @@ Feature: Custom formats
|
|||
| velit scelerisque fringilla. Phasellus pharetra justo et nulla fringilla, ac
|
||||
| porta sapien accumsan. Class aptent taciti sociosqu ad litora torquent per
|
||||
| conubia nostra, per inceptos himenaeos.
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -114,11 +108,9 @@ Feature: Custom formats
|
|||
Given we parse the output as JSON
|
||||
Then "entries" in the parsed output should have 2 elements
|
||||
And "tags" in the parsed output should be
|
||||
"""
|
||||
@ipsum
|
||||
@tagone
|
||||
@tagtwo
|
||||
"""
|
||||
And "entries.0.tags" in the parsed output should have 3 elements
|
||||
And "entries.1.tags" in the parsed output should have 1 elements
|
||||
|
||||
|
@ -133,7 +125,6 @@ Feature: Custom formats
|
|||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
Given we append to the editor if opened
|
||||
"""
|
||||
[2021-10-14 13:23] Heading Test
|
||||
|
||||
H1-1
|
||||
|
@ -176,12 +167,10 @@ Feature: Custom formats
|
|||
|
||||
More stuff
|
||||
more stuff again
|
||||
"""
|
||||
When we run "jrnl --edit -1"
|
||||
Then the editor should have been called
|
||||
When we run "jrnl -1 --export markdown"
|
||||
Then the output should be
|
||||
"""
|
||||
# 2021
|
||||
|
||||
## October
|
||||
|
@ -222,7 +211,6 @@ Feature: Custom formats
|
|||
|
||||
More stuff
|
||||
more stuff again
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -239,12 +227,10 @@ Feature: Custom formats
|
|||
Then the output should be a valid XML string
|
||||
And "entries" in the xml output should have 3 elements
|
||||
And "tags" in the xml output should contain
|
||||
"""
|
||||
@ipsum
|
||||
@tagone
|
||||
@tagtwo
|
||||
@tagthree
|
||||
"""
|
||||
And there should be 10 "tag" elements
|
||||
|
||||
Examples: configs
|
||||
|
@ -262,11 +248,9 @@ Feature: Custom formats
|
|||
Given we parse the output as XML
|
||||
Then "entries" in the parsed output should have 2 elements
|
||||
And "tags" in the parsed output should be
|
||||
"""
|
||||
@idea
|
||||
@journal
|
||||
@dan
|
||||
"""
|
||||
And there should be 7 "tag" elements
|
||||
|
||||
Scenario Outline: Exporting tags
|
||||
|
@ -274,12 +258,10 @@ Feature: Custom formats
|
|||
And we use the password "test" if prompted
|
||||
When we run "jrnl --export tags"
|
||||
Then the output should be
|
||||
"""
|
||||
@tagtwo : 2
|
||||
@tagone : 2
|
||||
@tagthree : 1
|
||||
@ipsum : 1
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -311,7 +293,6 @@ Feature: Custom formats
|
|||
And we use the password "test" if prompted
|
||||
When we run "jrnl --export fancy"
|
||||
Then the output should be
|
||||
"""
|
||||
┎──────────────────────────────────────────────────────────────╮2020-08-29 11:11
|
||||
┃ Entry the first. ╘═══════════════╕
|
||||
┠╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
||||
|
@ -394,7 +375,6 @@ Feature: Custom formats
|
|||
┃ Phasellus aliquam lacus placerat convallis vestibulum. Curabitur maximus at │
|
||||
┃ ante eget fringilla. @tagthree and also @tagone │
|
||||
┖──────────────────────────────────────────────────────────────────────────────┘
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -410,14 +390,11 @@ Feature: Custom formats
|
|||
And we create a cache directory
|
||||
When we run "jrnl --format yaml --file {cache_dir}"
|
||||
Then the cache directory should contain the files
|
||||
"""
|
||||
2020-08-29_entry-the-first.md
|
||||
2020-08-31_a-second-entry-in-what-i-hope-to-be-a-long-series.md
|
||||
2020-09-24_the-third-entry-finally-after-weeks-without-writing.md
|
||||
"""
|
||||
|
||||
And the content of file "2020-08-29_entry-the-first.md" in the cache should be
|
||||
"""
|
||||
---
|
||||
title: Entry the first.
|
||||
date: 2020-08-29 11:11
|
||||
|
@ -443,7 +420,6 @@ Feature: Custom formats
|
|||
porta sapien accumsan. Class aptent taciti sociosqu ad litora torquent per
|
||||
conubia nostra, per inceptos himenaeos.
|
||||
...
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -475,13 +451,10 @@ Feature: Custom formats
|
|||
And we create a cache directory
|
||||
When we run "jrnl --export yaml -o {cache_dir}"
|
||||
Then the cache should contain the files
|
||||
"""
|
||||
2020-08-29_entry-the-first.md
|
||||
2020-08-31_a-second-entry-in-what-i-hope-to-be-a-long-series.md
|
||||
2020-09-24_the-third-entry-finally-after-weeks-without-writing.md
|
||||
"""
|
||||
And the content of file "2020-09-24_the-third-entry-finally-after-weeks-without-writing.md" in the cache should be
|
||||
"""
|
||||
---
|
||||
title: The third entry finally after weeks without writing.
|
||||
date: 2020-09-24 09:14
|
||||
|
@ -499,7 +472,6 @@ Feature: Custom formats
|
|||
Phasellus aliquam lacus placerat convallis vestibulum. Curabitur maximus at
|
||||
ante eget fringilla. @tagthree and also @tagone
|
||||
...
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -544,7 +516,6 @@ Feature: Custom formats
|
|||
Given we use the config "format_md.yaml"
|
||||
When we run "jrnl -n 1"
|
||||
Then the output should be
|
||||
"""
|
||||
# 2013
|
||||
|
||||
## June
|
||||
|
@ -552,16 +523,13 @@ Feature: Custom formats
|
|||
### 2013-06-10 15:40 Life is good.
|
||||
|
||||
But I'm better.
|
||||
"""
|
||||
|
||||
Scenario: Text Formatter from config file
|
||||
Given we use the config "format_text.yaml"
|
||||
When we run "jrnl -n 1"
|
||||
Then the output should be
|
||||
"""
|
||||
[2013-06-10 15:40] Life is good.
|
||||
But I'm better.
|
||||
"""
|
||||
|
||||
Scenario Outline: Exporting entries with Cyrillic characters to directory should not fail
|
||||
Given we use the config "<config_file>"
|
||||
|
@ -570,9 +538,7 @@ Feature: Custom formats
|
|||
When we run "jrnl 2020-11-21: Первая"
|
||||
When we run "jrnl --format md --file {cache_dir} -on 2020-11-21"
|
||||
Then the cache should contain the files
|
||||
"""
|
||||
2020-11-21_первая.md
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -587,11 +553,9 @@ Feature: Custom formats
|
|||
When we run "jrnl 2020-08-31 01:01: Hi."
|
||||
And we run "jrnl --format dates"
|
||||
Then the output should be
|
||||
"""
|
||||
2020-08-29, 1
|
||||
2020-08-31, 2
|
||||
2020-09-24, 1
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -638,42 +602,30 @@ Feature: Custom formats
|
|||
Given we use the config "basic_onefile.yaml"
|
||||
When we run "jrnl --list"
|
||||
Then the output should match
|
||||
"""
|
||||
Journals defined in config \(.+basic_onefile\.yaml\)
|
||||
\* default -> features/journals/basic_onefile\.journal
|
||||
"""
|
||||
When we run "jrnl --list --format json"
|
||||
Then the output should match
|
||||
"""
|
||||
{"config_path": ".+basic_onefile\.yaml", "journals": {"default": "features/journals/basic_onefile\.journal"}}
|
||||
"""
|
||||
When we run "jrnl --list --format yaml"
|
||||
Then the output should match
|
||||
"""
|
||||
config_path: .+basic_onefile\.yaml
|
||||
journals:
|
||||
default: features/journals/basic_onefile\.journal
|
||||
"""
|
||||
|
||||
Scenario: Export journal list to formats with no default journal
|
||||
Given we use the config "no_default_journal.yaml"
|
||||
When we run "jrnl --list"
|
||||
Then the output should match
|
||||
"""
|
||||
Journals defined in config \(.+no_default_journal\.yaml\)
|
||||
\* simple -> features/journals/simple\.journal
|
||||
\* work -> features/journals/work\.journal
|
||||
"""
|
||||
When we run "jrnl --list --format json"
|
||||
Then the output should match
|
||||
"""
|
||||
{"config_path": ".+no_default_journal\.yaml", "journals": {"simple": "features/journals/simple\.journal", "work": "features/journals/work\.journal"}}
|
||||
"""
|
||||
When we run "jrnl --list --format yaml"
|
||||
Then the output should match
|
||||
"""
|
||||
config_path: .+no_default_journal\.yaml
|
||||
journals:
|
||||
simple: features/journals/simple\.journal
|
||||
work: features/journals/work\.journal
|
||||
"""
|
||||
|
|
|
@ -21,7 +21,6 @@ Feature: Importing data
|
|||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --import" and pipe
|
||||
"""
|
||||
[2020-07-05 15:00] Observe and import.
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada quis
|
||||
est ac dignissim. Aliquam dignissim rutrum pretium. Phasellus pellentesque augue
|
||||
|
@ -29,7 +28,6 @@ Feature: Importing data
|
|||
Aenean ante ex, elementum ut interdum et, mattis eget lacus. In commodo nulla nec
|
||||
tellus placerat, sed ultricies metus bibendum. Duis eget venenatis erat. In at
|
||||
dolor dui end of entry.
|
||||
"""
|
||||
When we run "jrnl -on 2020-07-05"
|
||||
Then the output should contain "2020-07-05 15:00 Observe and import."
|
||||
And the output should contain "Lorem ipsum"
|
||||
|
@ -46,13 +44,11 @@ Feature: Importing data
|
|||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --import" and pipe
|
||||
"""
|
||||
[2020-07-05 15:00] Observe and import.
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
|
||||
[2020-07-05 15:01] Twice as nice.
|
||||
Sed dignissim sed nisl eu consequat.
|
||||
"""
|
||||
When we run "jrnl -on 2020-07-05"
|
||||
Then the output should contain "2020-07-05 15:00 Observe and import."
|
||||
And the output should contain "Lorem ipsum"
|
||||
|
@ -87,9 +83,7 @@ Feature: Importing data
|
|||
But the output should not contain "I have an @idea"
|
||||
And the output should not contain "I met with"
|
||||
When we run "jrnl --import --file features/journals/tags.journal" and pipe
|
||||
"""
|
||||
[2020-07-05 15:00] I should not exist!
|
||||
"""
|
||||
And we run "jrnl -99"
|
||||
Then the output should contain "My first entry."
|
||||
And the output should contain "PROFIT!"
|
||||
|
|
|
@ -3,11 +3,9 @@ Feature: Installing jrnl
|
|||
Scenario: Install jrnl with default options
|
||||
Given we use no config
|
||||
When we run "jrnl hello world" and enter
|
||||
"""
|
||||
\n
|
||||
\n
|
||||
\n
|
||||
"""
|
||||
Then the output should contain "jrnl configuration created at"
|
||||
And the output should contain "For advanced features, read the docs at https://jrnl.sh"
|
||||
And the output should contain "Journal 'default' created"
|
||||
|
@ -18,11 +16,9 @@ Feature: Installing jrnl
|
|||
Scenario: Install jrnl with custom relative default journal path
|
||||
Given we use no config
|
||||
When we run "jrnl hello world" and enter
|
||||
"""
|
||||
default/custom.txt
|
||||
n
|
||||
\n
|
||||
"""
|
||||
Then the output should contain "Journal 'default' created"
|
||||
And the default journal "custom.txt" should be in the "default" directory
|
||||
And the config should contain "encrypt: false"
|
||||
|
@ -32,11 +28,9 @@ Feature: Installing jrnl
|
|||
Given we use no config
|
||||
And the home directory is called "home"
|
||||
When we run "jrnl hello world" and enter
|
||||
"""
|
||||
~/custom.txt
|
||||
n
|
||||
\n
|
||||
"""
|
||||
Then the output should contain "Journal 'default' created"
|
||||
And the default journal "custom.txt" should be in the "home" directory
|
||||
And the config should contain "encrypt: false"
|
||||
|
@ -45,11 +39,9 @@ Feature: Installing jrnl
|
|||
Scenario: Install jrnl with encrypted default journal
|
||||
Given we use no config
|
||||
When we run "jrnl hello world" and enter
|
||||
"""
|
||||
encrypted.txt
|
||||
y
|
||||
\n
|
||||
"""
|
||||
Then the output should contain "Journal will be encrypted"
|
||||
And the default journal "encrypted.txt" should be in the "." directory
|
||||
And the config should contain "encrypt: true"
|
||||
|
@ -60,58 +52,46 @@ Feature: Installing jrnl
|
|||
Scenario: Install jrnl with colors by default
|
||||
Given we use no config
|
||||
When we run "jrnl hello world" and enter
|
||||
"""
|
||||
\n
|
||||
\n
|
||||
\n
|
||||
"""
|
||||
Then the output should contain "Journal 'default' created"
|
||||
And the config should contain
|
||||
"""
|
||||
colors:
|
||||
body: none
|
||||
date: black
|
||||
tags: yellow
|
||||
title: cyan
|
||||
"""
|
||||
|
||||
Scenario: Install jrnl without colors
|
||||
Given we use no config
|
||||
When we run "jrnl hello world" and enter
|
||||
"""
|
||||
\n
|
||||
\n
|
||||
N
|
||||
"""
|
||||
Then the output should contain "Journal 'default' created"
|
||||
And the config should contain
|
||||
"""
|
||||
colors:
|
||||
body: none
|
||||
date: none
|
||||
tags: none
|
||||
title: none
|
||||
"""
|
||||
|
||||
Scenario: Install jrnl with encrypted default journal with no entries
|
||||
Given we use no config
|
||||
When we run "jrnl -1" and enter
|
||||
"""
|
||||
encrypted.txt
|
||||
y
|
||||
n
|
||||
test
|
||||
test
|
||||
n
|
||||
"""
|
||||
Then the error output should contain "Journal will be encrypted"
|
||||
And the default journal "encrypted.txt" should be in the "." directory
|
||||
And the config should contain "encrypt: true"
|
||||
And the version in the config file should be up-to-date
|
||||
When we run "jrnl -1" and enter
|
||||
"""
|
||||
test
|
||||
"""
|
||||
test
|
||||
Then we should be prompted for a password
|
||||
And the error output should contain "no entries found"
|
||||
And the error output should not contain "Wrong password, try again"
|
||||
|
|
|
@ -7,10 +7,8 @@ Feature: Multiple journals
|
|||
Given we use the config "multiple.yaml"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
"""
|
||||
When we run "jrnl work -99 --short"
|
||||
Then the output should be empty
|
||||
|
||||
|
@ -19,14 +17,10 @@ Feature: Multiple journals
|
|||
When we run "jrnl this goes to default"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should contain
|
||||
"""
|
||||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
"""
|
||||
Then the output should contain
|
||||
"""
|
||||
this goes to default
|
||||
"""
|
||||
When we run "jrnl work -99 --short"
|
||||
Then the output should be empty
|
||||
|
||||
|
@ -35,10 +29,8 @@ Feature: Multiple journals
|
|||
When we run "jrnl work a long day in the office"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
"""
|
||||
When we run "jrnl work -99 --short"
|
||||
Then the output should contain "a long day in the office"
|
||||
|
||||
|
@ -52,44 +44,32 @@ Feature: Multiple journals
|
|||
When we run "jrnl work 23 july 2012: a long day in the office"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
"""
|
||||
When we run "jrnl work -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2012-07-23 09:00 a long day in the office
|
||||
"""
|
||||
|
||||
Scenario: Write to specified journal without a timestamp but with colon
|
||||
Given we use the config "multiple.yaml"
|
||||
When we run "jrnl work : a long day in the office"
|
||||
Then the output should be
|
||||
"""
|
||||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
"""
|
||||
When we run "jrnl work -99 --short"
|
||||
Then the output should be contain
|
||||
"""
|
||||
a long day in the office
|
||||
"""
|
||||
|
||||
Scenario: Write to specified journal without a timestamp but with colon
|
||||
Given we use the config "multiple.yaml"
|
||||
When we run "jrnl work: a long day in the office"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
"""
|
||||
When we run "jrnl work -99 --short"
|
||||
Then the output should contain
|
||||
"""
|
||||
a long day in the office
|
||||
"""
|
||||
|
||||
Scenario: Create new journals as required
|
||||
Given we use the config "multiple.yaml"
|
||||
|
@ -97,9 +77,7 @@ Feature: Multiple journals
|
|||
When we run "jrnl ideas 23 july 2012: sell my junk on ebay and make lots of money"
|
||||
When we run "jrnl ideas -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2012-07-23 09:00 sell my junk on ebay and make lots of money
|
||||
"""
|
||||
|
||||
Scenario: Don't crash if no default journal is specified
|
||||
Given we use the config "no_default_journal.yaml"
|
||||
|
@ -109,11 +87,9 @@ Feature: Multiple journals
|
|||
Scenario: Don't crash if no file exists for a configured encrypted journal
|
||||
Given we use the config "multiple.yaml"
|
||||
When we run "jrnl new_encrypted Adding first entry" and enter
|
||||
"""
|
||||
these three eyes
|
||||
these three eyes
|
||||
n
|
||||
"""
|
||||
Then the output should contain "Journal 'new_encrypted' created at"
|
||||
|
||||
Scenario: Read and write to journal with emoji name
|
||||
|
|
|
@ -7,9 +7,7 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
|
|||
Given we use the config "basic_encrypted.yaml"
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --config-override editor ''" and type
|
||||
"""
|
||||
This is a journal entry
|
||||
"""
|
||||
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"
|
||||
|
@ -29,7 +27,6 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
|
|||
And we use the password "test" if prompted
|
||||
When we run "jrnl -2 --config-override linewrap 23 --format fancy"
|
||||
Then the output should be
|
||||
"""
|
||||
┎─────╮2013-06-09 15:39
|
||||
┃ My ╘═══════════════╕
|
||||
┃ fir st ent ry. │
|
||||
|
@ -43,7 +40,6 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
|
|||
┠╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
|
||||
┃ But I'm better. │
|
||||
┖─────────────────────┘
|
||||
"""
|
||||
|
||||
|
||||
Scenario: Override color selections with runtime overrides
|
||||
|
@ -63,14 +59,12 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
|
|||
And we use the password "test" if prompted
|
||||
When we run "jrnl -1 --config-override colors.body green --config-override editor 'nano'"
|
||||
Then the config in memory should contain
|
||||
"""
|
||||
editor: nano
|
||||
colors:
|
||||
title: none
|
||||
body: green
|
||||
tags: none
|
||||
date: none
|
||||
"""
|
||||
|
||||
|
||||
Scenario: Override default journal
|
||||
|
@ -80,7 +74,6 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
|
|||
Then we should get no error
|
||||
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
|
||||
|
||||
2013-06-09 15:39 My first entry.
|
||||
|
@ -88,7 +81,6 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
|
|||
|
||||
2013-06-10 15:40 Life is good.
|
||||
| But I'm better.
|
||||
"""
|
||||
|
||||
|
||||
Scenario: Make an entry into an overridden journal
|
||||
|
@ -99,7 +91,6 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
|
|||
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
|
||||
|
||||
2013-06-09 15:39 My first entry.
|
||||
|
@ -107,4 +98,3 @@ Feature: Implementing Runtime Overrides for Select Configuration Keys
|
|||
|
||||
2013-06-10 15:40 Life is good.
|
||||
| But I'm better.
|
||||
"""
|
||||
|
|
|
@ -7,11 +7,9 @@ Feature: Using the installed keyring
|
|||
Given we use the config "multiple.yaml"
|
||||
And we have a keyring
|
||||
When we run "jrnl simple --encrypt" and enter
|
||||
"""
|
||||
sabertooth
|
||||
sabertooth
|
||||
Y
|
||||
"""
|
||||
Then the config for journal "simple" should contain "encrypt: true"
|
||||
When we run "jrnl simple -n 1"
|
||||
Then the output should contain "2013-06-10 15:40 Life is good"
|
||||
|
@ -21,11 +19,9 @@ Feature: Using the installed keyring
|
|||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl test entry"
|
||||
And we run "jrnl --encrypt" and enter
|
||||
"""
|
||||
password
|
||||
password
|
||||
n
|
||||
"""
|
||||
Then we should get no error
|
||||
And the output should not contain "Failed to retrieve keyring"
|
||||
|
||||
|
@ -34,11 +30,9 @@ Feature: Using the installed keyring
|
|||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl test entry"
|
||||
And we run "jrnl --encrypt" and enter
|
||||
"""
|
||||
password
|
||||
password
|
||||
y
|
||||
"""
|
||||
Then we should get no error
|
||||
And the output should not contain "Failed to retrieve keyring"
|
||||
# @todo add step to check contents of keyring
|
||||
|
@ -61,11 +55,9 @@ Feature: Using the installed keyring
|
|||
Given we use the config "simple.yaml"
|
||||
And we have a failed keyring
|
||||
When we run "jrnl --encrypt" and enter
|
||||
"""
|
||||
this password will not be saved in keyring
|
||||
this password will not be saved in keyring
|
||||
y
|
||||
"""
|
||||
Then the output should contain "Failed to retrieve keyring"
|
||||
And we should get no error
|
||||
And we should be prompted for a password
|
||||
|
@ -85,10 +77,8 @@ Feature: Using the installed keyring
|
|||
When we run "jrnl --short"
|
||||
Then we should not be prompted for a password
|
||||
And the output should be
|
||||
"""
|
||||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
"""
|
||||
|
||||
|
||||
Scenario: Open encrypted journal when keyring exists but fails
|
||||
|
@ -106,31 +96,25 @@ Feature: Using the installed keyring
|
|||
Scenario: Mistyping your password
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl --encrypt" and enter
|
||||
"""
|
||||
swordfish
|
||||
sordfish
|
||||
"""
|
||||
Then we should be prompted for a password
|
||||
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
|
||||
"""
|
||||
2013-06-09 15:39 My first entry.
|
||||
2013-06-10 15:40 Life is good.
|
||||
"""
|
||||
|
||||
|
||||
Scenario: Mistyping your password, then getting it right
|
||||
Given we use the config "simple.yaml"
|
||||
When we run "jrnl --encrypt" and enter
|
||||
"""
|
||||
swordfish
|
||||
sordfish
|
||||
swordfish
|
||||
swordfish
|
||||
n
|
||||
"""
|
||||
Then we should be prompted for a password
|
||||
And the output should contain "Passwords did not match"
|
||||
And the output should contain "Journal encrypted"
|
||||
|
|
|
@ -65,9 +65,7 @@ Feature: Searching in a journal
|
|||
Then we should get no error
|
||||
And the output should contain "1 entry found"
|
||||
And the output should be
|
||||
"""
|
||||
2020-08-29 11:11 Entry the first.
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -94,11 +92,9 @@ Feature: Searching in a journal
|
|||
Then we should get no error
|
||||
And the output should contain "3 entries found"
|
||||
And the output should be
|
||||
"""
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -112,9 +108,7 @@ Feature: Searching in a journal
|
|||
Then we should get no error
|
||||
And the output should contain "1 entry found"
|
||||
And the output should be
|
||||
"""
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -225,23 +219,19 @@ Feature: Searching in a journal
|
|||
Then we should get no error
|
||||
When we run "jrnl -2"
|
||||
Then the output should be
|
||||
"""
|
||||
2013-07-23 09:00 Testing folder journal.
|
||||
|
||||
2014-03-07 16:37 Second entry of journal.
|
||||
"""
|
||||
|
||||
Scenario Outline: Searching for all tags should show counts of each tag
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --tags"
|
||||
Then we should get no error
|
||||
And the output should be
|
||||
"""
|
||||
@tagtwo : 2
|
||||
@tagone : 2
|
||||
@tagthree : 1
|
||||
@ipsum : 1
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -254,10 +244,8 @@ Feature: Searching in a journal
|
|||
When we run "jrnl -from 'september 2020' --tags"
|
||||
Then we should get no error
|
||||
And the output should be
|
||||
"""
|
||||
@tagthree : 1
|
||||
@tagone : 1
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -269,10 +257,8 @@ Feature: Searching in a journal
|
|||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --tags -not @tagtwo"
|
||||
Then the output should be
|
||||
"""
|
||||
@tagthree : 1
|
||||
@tagone : 1
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -284,9 +270,7 @@ Feature: Searching in a journal
|
|||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --tags -not @tagone -not @tagthree"
|
||||
Then the output should be
|
||||
"""
|
||||
@tagtwo : 1
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -318,13 +302,11 @@ Feature: Searching in a journal
|
|||
When we run "jrnl -2"
|
||||
Then we should get no error
|
||||
And the output should be
|
||||
"""
|
||||
2013-06-09 15:39 My first entry.
|
||||
| Everything is alright
|
||||
|
||||
2013-06-10 15:40 Life is good.
|
||||
| But I'm better.
|
||||
"""
|
||||
|
||||
Scenario Outline: Searching by month
|
||||
Given we use the config "<config_file>"
|
||||
|
@ -399,10 +381,8 @@ Feature: Searching in a journal
|
|||
And we run "jrnl -today-in-history --short"
|
||||
Then the output should contain "2 entries found"
|
||||
And the output should be
|
||||
"""
|
||||
2019-08-31 01:01 Hi, from last year.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -417,13 +397,11 @@ Feature: Searching in a journal
|
|||
Then we should get no error
|
||||
And the output should contain "3 entries found"
|
||||
And the output should be
|
||||
"""
|
||||
2013-05-17 11:39 This entry has tags!
|
||||
|
||||
2013-06-17 20:38 This entry has a location.
|
||||
|
||||
2013-07-17 11:38 This entry is starred!
|
||||
"""
|
||||
|
||||
Scenario Outline: Searching the most recent entry should not show found count
|
||||
Given we use the config "<config_file>"
|
||||
|
|
|
@ -11,11 +11,9 @@ Feature: Tagging
|
|||
When we run "jrnl --tags -on 2020-09-26"
|
||||
Then we should get no error
|
||||
And the output should be
|
||||
"""
|
||||
@os/2 : 1
|
||||
@c++ : 1
|
||||
@c# : 1
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -43,10 +41,8 @@ Feature: Tagging
|
|||
When we run "jrnl 2020-09-26: @foo came over, we went to a @bar"
|
||||
When we run "jrnl --tags -on 2020-09-26"
|
||||
Then the output should be
|
||||
"""
|
||||
@foo : 1
|
||||
@bar : 1
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
|
|
@ -2,13 +2,12 @@
|
|||
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Feature: Using templates
|
||||
|
||||
Scenario Outline: Template contents should be used in new 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 an addition to a templated entry
|
||||
"""
|
||||
When we run "jrnl --config-override template features/templates/basic.template"
|
||||
And we run "jrnl -1"
|
||||
Then the output should contain "This text is in the basic template"
|
||||
|
|
|
@ -8,27 +8,19 @@ Feature: Upgrading Journals from 1.x.x to 2.x.x
|
|||
When we run "jrnl -9" and enter "Y"
|
||||
When we run "jrnl -99 --short"
|
||||
Then the output should be
|
||||
"""
|
||||
2010-06-10 15:00 A life without chocolate is like a bad analogy.
|
||||
2013-06-10 15:40 He said "[this] is the best time to be alive".Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent malesuada
|
||||
"""
|
||||
And the output should contain
|
||||
"""
|
||||
2010-06-10 15:00 A life without chocolate is like a bad analogy.
|
||||
"""
|
||||
And the output should contain
|
||||
"""
|
||||
2013-06-10 15:40 He said "[this] is the best time to be alive".
|
||||
"""
|
||||
|
||||
Scenario: Upgrading a journal encrypted with jrnl 1.x
|
||||
Given we use the config "encrypted_old.json"
|
||||
When we run "jrnl -n 1" and enter
|
||||
"""
|
||||
Y
|
||||
bad doggie no biscuit
|
||||
bad doggie no biscuit
|
||||
"""
|
||||
Then we should be prompted for a password
|
||||
And the output should contain "2013-06-10 15:40 Life is good"
|
||||
|
||||
|
@ -36,22 +28,18 @@ Feature: Upgrading Journals from 1.x.x to 2.x.x
|
|||
Given we use the config "no_colors.yaml"
|
||||
When we run "jrnl -n 1"
|
||||
Then the config should contain
|
||||
"""
|
||||
colors:
|
||||
date: none
|
||||
title: none
|
||||
body: none
|
||||
tags: none
|
||||
"""
|
||||
|
||||
Scenario: Upgrade and parse journals with little endian date format
|
||||
Given we use the config "upgrade_from_195_little_endian_dates.json"
|
||||
When we run "jrnl -9 --short" and enter "Y"
|
||||
Then the output should contain
|
||||
"""
|
||||
10.06.2010 15:00 A life without chocolate is like a bad analogy.
|
||||
10.06.2013 15:40 He said "[this] is the best time to be alive".
|
||||
"""
|
||||
|
||||
Scenario: Upgrade with missing journal
|
||||
Given we use the config "upgrade_from_195_with_missing_journal.json"
|
||||
|
@ -62,10 +50,8 @@ Feature: Upgrading Journals from 1.x.x to 2.x.x
|
|||
Scenario: Upgrade with missing encrypted journal
|
||||
Given we use the config "upgrade_from_195_with_missing_encrypted_journal.json"
|
||||
When we run "jrnl --list" and enter
|
||||
"""
|
||||
Y
|
||||
bad doggie no biscuit
|
||||
"""
|
||||
Then the output should contain "features/journals/missing.journal does not exist"
|
||||
And the output should contain "We're all done"
|
||||
And we should get no error
|
||||
|
|
|
@ -67,9 +67,7 @@ Feature: Writing new entries.
|
|||
Then we should get no error
|
||||
Then the editor should have been called
|
||||
And the editor file content should be
|
||||
"""
|
||||
this is a partial
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -148,10 +146,8 @@ Feature: Writing new entries.
|
|||
Then we should get no error
|
||||
When we run "jrnl -1"
|
||||
Then the output should be
|
||||
"""
|
||||
2014-04-24 09:00 Created a new website - empty.com.
|
||||
| Hope to get a lot of traffic.
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -210,17 +206,13 @@ Feature: Writing new entries.
|
|||
Given we parse the output as JSON
|
||||
Then "entries" in the parsed output should have 5 elements
|
||||
And "entries.0.creator" in the parsed output should be
|
||||
"""
|
||||
software_agent
|
||||
os_agent
|
||||
host_name
|
||||
generation_date
|
||||
device_agent
|
||||
"""
|
||||
And "entries.0.creator.software_agent" in the parsed output should contain
|
||||
"""
|
||||
jrnl
|
||||
"""
|
||||
|
||||
Scenario: Title with an embedded period on DayOne journal
|
||||
Given we use the config "dayone.yaml"
|
||||
|
@ -228,10 +220,8 @@ Feature: Writing new entries.
|
|||
Then we should get no error
|
||||
When we run "jrnl -1"
|
||||
Then the output should be
|
||||
"""
|
||||
2014-04-24 09:00 Ran 6.2 miles today in 1:02:03.
|
||||
| I am feeling sore because I forgot to stretch.
|
||||
"""
|
||||
|
||||
Scenario: Opening an folder that's not a DayOne folder should treat as folder journal
|
||||
Given we use the config "empty_folder.yaml"
|
||||
|
@ -244,9 +234,7 @@ Feature: Writing new entries.
|
|||
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 error output should contain "3 entries found"
|
||||
And the error output should contain "1 entry added"
|
||||
|
@ -264,11 +252,9 @@ Feature: Writing new entries.
|
|||
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 error output should contain "3 entries found"
|
||||
And the error output should contain "3 entries added"
|
||||
|
@ -285,9 +271,7 @@ Feature: Writing new entries.
|
|||
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"
|
||||
And the output should contain "1 entry modified"
|
||||
|
@ -304,9 +288,7 @@ Feature: Writing new entries.
|
|||
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 error output should contain "1 entry modified"
|
||||
|
||||
|
@ -322,9 +304,7 @@ Feature: Writing new entries.
|
|||
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 error output should contain "3 entries found"
|
||||
And the error output should contain "1 entry modified"
|
||||
|
@ -361,16 +341,12 @@ Feature: Writing new entries.
|
|||
Given we use the config "<config_file>"
|
||||
And we use the password "test" if prompted
|
||||
And we append to the editor if opened
|
||||
"""
|
||||
@newtag
|
||||
"""
|
||||
When we run "jrnl --edit -1"
|
||||
Then the error output should contain "1 entry modified"
|
||||
When we run "jrnl --tags @newtag"
|
||||
Then the output should contain
|
||||
"""
|
||||
1 entry found
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
|
|
@ -13,7 +13,6 @@ from xml.etree import ElementTree as ET
|
|||
|
||||
from pytest_bdd import given
|
||||
from pytest_bdd.parsers import parse
|
||||
from pytest_bdd.parsers import re
|
||||
|
||||
from jrnl import __version__
|
||||
from jrnl.time import __get_pdt_calendar
|
||||
|
@ -22,11 +21,7 @@ from tests.lib.fixtures import NoKeyring
|
|||
from tests.lib.fixtures import TestKeyring
|
||||
|
||||
|
||||
@given(re(r"we (?P<editor_method>\w+) to the editor if opened"))
|
||||
def we_enter_editor_docstring(editor_method, editor_state, docstring):
|
||||
we_enter_editor(editor_method, docstring, editor_state)
|
||||
|
||||
|
||||
@given(parse("we {editor_method} to the editor if opened\n{editor_input}"))
|
||||
@given(parse("we {editor_method} nothing to the editor if opened"))
|
||||
def we_enter_editor(editor_method, editor_input, editor_state):
|
||||
file_method = editor_state["intent"]["method"]
|
||||
|
|
|
@ -8,7 +8,6 @@ from xml.etree import ElementTree as ET
|
|||
|
||||
from pytest_bdd import then
|
||||
from pytest_bdd.parsers import parse
|
||||
from pytest_bdd.parsers import re as pytest_bdd_parsers_re
|
||||
from ruamel.yaml import YAML
|
||||
|
||||
from jrnl.config import scope_config
|
||||
|
@ -31,11 +30,7 @@ def should_get_an_error(cli_run):
|
|||
assert cli_run["status"] != 0, cli_run["status"]
|
||||
|
||||
|
||||
@then(parse("the output should match"))
|
||||
def output_should_match_docstring(cli_run, docstring):
|
||||
output_should_match(docstring, cli_run)
|
||||
|
||||
|
||||
@then(parse("the output should match\n{regex}"))
|
||||
@then(parse('the output should match "{regex}"'))
|
||||
def output_should_match(regex, cli_run):
|
||||
out = cli_run["stdout"]
|
||||
|
@ -43,18 +38,14 @@ 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 {it_should:Should} contain", SHOULD_DICT))
|
||||
@then(parse("the output {it_should:Should} contain\n{expected}", SHOULD_DICT))
|
||||
@then(parse('the output {it_should:Should} contain "{expected}"', SHOULD_DICT))
|
||||
@then(
|
||||
parse(
|
||||
"the {which_output_stream} output {it_should:Should} contain",
|
||||
"the {which_output_stream} output {it_should:Should} contain\n{expected}",
|
||||
SHOULD_DICT,
|
||||
)
|
||||
)
|
||||
def output_should_contain_docstring(which_output_stream, cli_run, it_should, docstring):
|
||||
output_should_contain(docstring, which_output_stream, cli_run, it_should)
|
||||
|
||||
|
||||
@then(parse('the output {it_should:Should} contain "{expected}"', SHOULD_DICT))
|
||||
@then(
|
||||
parse(
|
||||
'the {which_output_stream} output {it_should:Should} contain "{expected}"',
|
||||
|
@ -84,21 +75,13 @@ def output_should_contain(expected, which_output_stream, cli_run, it_should):
|
|||
assert (expected in cli_run[which_output_stream]) == it_should, output_str
|
||||
|
||||
|
||||
@then(parse("the output should not contain"))
|
||||
def output_should_not_contain_docstring(cli_run, docstring):
|
||||
output_should_not_contain(docstring, cli_run)
|
||||
|
||||
|
||||
@then(parse("the output should not contain\n{expected_output}"))
|
||||
@then(parse('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"))
|
||||
def output_should_be_docstring(cli_run, docstring):
|
||||
output_should_be(docstring, cli_run)
|
||||
|
||||
|
||||
@then(parse("the output should be\n{expected_output}"))
|
||||
@then(parse('the output should be "{expected_output}"'))
|
||||
def output_should_be(expected_output, cli_run):
|
||||
actual = cli_run["stdout"].strip()
|
||||
|
@ -154,17 +137,6 @@ def default_journal_location(journal_file, journal_dir, config_on_disk, temp_dir
|
|||
assert os.path.samefile(default_journal_path, expected_journal_path)
|
||||
|
||||
|
||||
@then(
|
||||
parse(
|
||||
'the config for journal "{journal_name}" {it_should:Should} contain',
|
||||
SHOULD_DICT,
|
||||
)
|
||||
)
|
||||
@then(parse("the config {it_should:Should} contain", SHOULD_DICT))
|
||||
def config_var_on_disk_docstring(config_on_disk, journal_name, it_should, docstring):
|
||||
config_var_on_disk(config_on_disk, journal_name, it_should, docstring)
|
||||
|
||||
|
||||
@then(
|
||||
parse(
|
||||
'the config for journal "{journal_name}" '
|
||||
|
@ -172,7 +144,15 @@ def config_var_on_disk_docstring(config_on_disk, journal_name, it_should, docstr
|
|||
SHOULD_DICT,
|
||||
)
|
||||
)
|
||||
@then(
|
||||
parse(
|
||||
'the config for journal "{journal_name}" '
|
||||
"{it_should:Should} contain\n{some_yaml}",
|
||||
SHOULD_DICT,
|
||||
)
|
||||
)
|
||||
@then(parse('the config {it_should:Should} contain "{some_yaml}"', SHOULD_DICT))
|
||||
@then(parse("the config {it_should:Should} contain\n{some_yaml}", SHOULD_DICT))
|
||||
def config_var_on_disk(config_on_disk, journal_name, it_should, some_yaml):
|
||||
actual = config_on_disk
|
||||
if journal_name:
|
||||
|
@ -188,20 +168,6 @@ def config_var_on_disk(config_on_disk, journal_name, it_should, some_yaml):
|
|||
assert (expected == actual_slice) == it_should
|
||||
|
||||
|
||||
@then(
|
||||
parse(
|
||||
'the config in memory for journal "{journal_name}" '
|
||||
"{it_should:Should} contain",
|
||||
SHOULD_DICT,
|
||||
)
|
||||
)
|
||||
@then(parse("the config in memory {it_should:Should} contain", SHOULD_DICT))
|
||||
def config_var_in_memory_docstring(
|
||||
config_in_memory, journal_name, it_should, docstring
|
||||
):
|
||||
config_var_in_memory(config_in_memory, journal_name, it_should, docstring)
|
||||
|
||||
|
||||
@then(
|
||||
parse(
|
||||
'the config in memory for journal "{journal_name}" '
|
||||
|
@ -209,9 +175,19 @@ def config_var_in_memory_docstring(
|
|||
SHOULD_DICT,
|
||||
)
|
||||
)
|
||||
@then(
|
||||
parse(
|
||||
'the config in memory for journal "{journal_name}" '
|
||||
"{it_should:Should} contain\n{some_yaml}",
|
||||
SHOULD_DICT,
|
||||
)
|
||||
)
|
||||
@then(
|
||||
parse('the config in memory {it_should:Should} contain "{some_yaml}"', SHOULD_DICT)
|
||||
)
|
||||
@then(
|
||||
parse("the config in memory {it_should:Should} contain\n{some_yaml}", SHOULD_DICT)
|
||||
)
|
||||
def config_var_in_memory(config_in_memory, journal_name, it_should, some_yaml):
|
||||
actual = config_in_memory["overrides"]
|
||||
if journal_name:
|
||||
|
@ -237,23 +213,21 @@ def password_was_not_called(cli_run):
|
|||
assert not cli_run["mocks"]["user_input"].return_value.input.called
|
||||
|
||||
|
||||
@then(parse("the cache directory should contain the files"))
|
||||
def assert_dir_contains_files(cache_dir, docstring):
|
||||
assert does_directory_contain_files(docstring, cache_dir["path"])
|
||||
@then(parse("the cache directory should contain the files\n{file_list}"))
|
||||
def assert_dir_contains_files(file_list, cache_dir):
|
||||
assert does_directory_contain_files(file_list, cache_dir["path"])
|
||||
|
||||
|
||||
@then(
|
||||
pytest_bdd_parsers_re(r"the cache directory should contain (?P<number>\d+) files")
|
||||
)
|
||||
@then(parse("the cache directory should contain {number} files"))
|
||||
def assert_dir_contains_n_files(cache_dir, number):
|
||||
assert does_directory_contain_n_files(cache_dir["path"], number)
|
||||
|
||||
|
||||
@then(parse("the journal directory should contain"))
|
||||
def journal_directory_should_contain(config_on_disk, docstring):
|
||||
@then(parse("the journal directory should contain\n{file_list}"))
|
||||
def journal_directory_should_contain(config_on_disk, file_list):
|
||||
scoped_config = scope_config(config_on_disk, "default")
|
||||
|
||||
assert does_directory_contain_files(docstring, scoped_config["journal"])
|
||||
assert does_directory_contain_files(file_list, scoped_config["journal"])
|
||||
|
||||
|
||||
@then(parse('journal "{journal_name}" should not exist'))
|
||||
|
@ -288,10 +262,10 @@ def directory_should_not_exist(config_on_disk, it_should, journal_name):
|
|||
assert dir_exists == it_should
|
||||
|
||||
|
||||
@then(parse('the content of file "{file_path}" in the cache should be'))
|
||||
def content_of_file_should_be(file_path, cache_dir, docstring):
|
||||
@then(parse('the content of file "{file_path}" in the cache should be\n{file_content}'))
|
||||
def content_of_file_should_be(file_path, file_content, cache_dir):
|
||||
assert cache_dir["exists"]
|
||||
expected_content = docstring.strip().splitlines()
|
||||
expected_content = file_content.strip().splitlines()
|
||||
|
||||
with open(os.path.join(cache_dir["path"], file_path), "r") as f:
|
||||
actual_content = f.read().strip().splitlines()
|
||||
|
@ -308,12 +282,12 @@ def content_of_file_should_be(file_path, cache_dir, docstring):
|
|||
]
|
||||
|
||||
|
||||
@then(parse("the cache should contain the files"))
|
||||
def cache_dir_contains_files(cache_dir, docstring):
|
||||
@then(parse("the cache should contain the files\n{file_list}"))
|
||||
def cache_dir_contains_files(file_list, cache_dir):
|
||||
assert cache_dir["exists"]
|
||||
|
||||
actual_files = os.listdir(cache_dir["path"])
|
||||
expected_files = docstring.split("\n")
|
||||
expected_files = file_list.split("\n")
|
||||
|
||||
# sort to deal with inconsistent default file ordering on different OS's
|
||||
actual_files.sort()
|
||||
|
@ -362,11 +336,11 @@ def assert_parsed_output_item_count(node_name, number, parsed_output):
|
|||
assert False, f"Language name {lang} not recognized"
|
||||
|
||||
|
||||
@then(parse('"{field_name}" in the parsed output should {comparison}'))
|
||||
def assert_output_field_content(field_name, comparison, parsed_output, docstring):
|
||||
@then(parse('"{field_name}" in the parsed output should {comparison}\n{expected_keys}'))
|
||||
def assert_output_field_content(field_name, comparison, expected_keys, parsed_output):
|
||||
lang = parsed_output["lang"]
|
||||
obj = parsed_output["obj"]
|
||||
expected_keys = docstring.split("\n")
|
||||
expected_keys = expected_keys.split("\n")
|
||||
if len(expected_keys) == 1:
|
||||
expected_keys = expected_keys[0]
|
||||
|
||||
|
@ -446,13 +420,9 @@ def editor_filename_suffix(suffix, editor_state):
|
|||
assert editor_state["tmpfile"]["name"].endswith(suffix), (editor_filename, suffix)
|
||||
|
||||
|
||||
@then(parse("the editor file content should {comparison}"))
|
||||
def contains_editor_file_docstring(comparison, editor_state, docstring):
|
||||
contains_editor_file(comparison, docstring, editor_state)
|
||||
|
||||
|
||||
@then(parse('the editor file content should {comparison} "{str_value}"'))
|
||||
@then(parse("the editor file content should {comparison} empty"))
|
||||
@then(parse("the editor file content should {comparison}\n{str_value}"))
|
||||
def contains_editor_file(comparison, str_value, editor_state):
|
||||
content = editor_state["tmpfile"]["content"]
|
||||
# content = f'\n"""\n{content}\n"""\n'
|
||||
|
|
|
@ -34,11 +34,7 @@ all_input = '("(?P<all_input>[^"]*)")'
|
|||
# an empty line of input internally for testing purposes.
|
||||
|
||||
|
||||
@when(re(f'we run "jrnl {command}" and {input_method}'))
|
||||
def we_run_jrnl_docstring(capsys, keyring, request, command, input_method, docstring):
|
||||
we_run_jrnl(capsys, keyring, request, command, input_method, docstring)
|
||||
|
||||
|
||||
@when(parse('we run "jrnl {command}" and {input_method}\n{all_input}'))
|
||||
@when(re(f'we run "jrnl ?{command}" and {input_method} {all_input}'))
|
||||
@when(re(f'we run "jrnl {command}"(?! and)'))
|
||||
@when('we run "jrnl"')
|
||||
|
|
Loading…
Add table
Reference in a new issue