Skip to content

Commit

Permalink
Rename 'none' option for SERVICE.name config option to 'local'
Browse files Browse the repository at this point in the history
More sensible and in alignment with the LocalServer(Client) classes
  • Loading branch information
pylipp committed Dec 5, 2020
1 parent 3cbf801 commit d0d1579
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [unreleased]
### Added
- The app is tested against Python 3.9.
### Changed
- The 'none' value for the `SERVICE.name` configuration option is renamed to 'local'.
### Fixed
- Filtering by the 'value' field when using the `list` command now works. (#58)
### Removed
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ You can use `financeager` as a client-server or a serverless application (defaul

The user request invoked from the CLI is passed to the backend which opens the appropriate database, processes the request, closes the database and returns a response. All communication happens within a single process, hence the label 'serverless'. The databases are stored in `~/.local/share/financeager`.

This option can be stored in the configuration file via

[SERVICE]
name = local

In vanilla financeager, this is little relevant since it is the default anyways.

### Client-server mode

Install the [financeager-flask](https://github.com/pylipp/financeager-flask) plugin.
Expand Down
2 changes: 1 addition & 1 deletion financeager/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def create(*, configuration, sinks, plugins):
The sinks are passed into the Client.
"""
clients = {
"none": LocalServerClient,
"local": LocalServerClient,
}

plugins = plugins or []
Expand Down
4 changes: 2 additions & 2 deletions financeager/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __init__(self, filepath=None, plugins=None):

def _init_defaults(self):
self._parser["SERVICE"] = {
"name": "none",
"name": "local",
}
self._parser["FRONTEND"] = {
"default_category": CategoryEntry.DEFAULT_NAME,
Expand Down Expand Up @@ -115,7 +115,7 @@ def _validate(self):
:raises: InvalidConfigError
"""
valid_services = ["none"]
valid_services = ["local"]
for p in self._plugins:
if isinstance(p, plugin.ServicePlugin):
valid_services.append(p.name)
Expand Down
4 changes: 2 additions & 2 deletions test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def cli_run(self, command_line, log_method="info", format_args=()):
@mock.patch("financeager.DATA_DIR", None)
class CliLocalServerNoneConfigTestCase(CliTestCase):

CONFIG_FILE_CONTENT = "" # service 'none' is the default anyway
CONFIG_FILE_CONTENT = "" # service 'local' is the default anyway

@mock.patch("tinydb.storages.MemoryStorage.write")
def test_add_entry(self, mocked_write):
Expand Down Expand Up @@ -138,7 +138,7 @@ class CliLocalServerTestCase(CliTestCase):

CONFIG_FILE_CONTENT = """\
[SERVICE]
name = none
name = local
[FRONTEND]
default_category = no-category"""
Expand Down
4 changes: 2 additions & 2 deletions test/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ def test_sections(self):
@mock.patch("financeager.CONFIG_FILEPATH", "/tmp/non-existing-config")
def test_get_option(self):
config = Configuration()
self.assertEqual(config.get_option("SERVICE", "name"), "none")
self.assertDictEqual(config.get_section("SERVICE"), {"name": "none"})
self.assertEqual(config.get_option("SERVICE", "name"), "local")
self.assertDictEqual(config.get_section("SERVICE"), {"name": "local"})

def test_invalid_config(self):
filepath = "/tmp/{}".format(int(time.time()))
Expand Down

0 comments on commit d0d1579

Please sign in to comment.