mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-07-07 00:36:13 +02:00
Add tests for colors in configs
- Identifying invalid color configs - Upgrading config from no colors -> colors
This commit is contained in:
parent
8053d250f4
commit
eb1ed3c0cd
5 changed files with 54 additions and 7 deletions
|
@ -8,6 +8,7 @@ from dateutil import parser as date_parser
|
|||
from ansiwrap import strip_color
|
||||
from collections import defaultdict
|
||||
import os
|
||||
import ast
|
||||
import json
|
||||
import yaml
|
||||
import keyring
|
||||
|
@ -234,12 +235,17 @@ def journal_doesnt_exist(context, journal_name="default"):
|
|||
@then('the config should have "{key}" set to "{value}"')
|
||||
@then('the config for journal "{journal}" should have "{key}" set to "{value}"')
|
||||
def config_var(context, key, value, journal=None):
|
||||
t, value = value.split(":")
|
||||
value = {
|
||||
"bool": lambda v: v.lower() == "true",
|
||||
"int": int,
|
||||
"str": str
|
||||
}[t](value)
|
||||
if not value[0] == "{":
|
||||
t, value = value.split(":")
|
||||
value = {
|
||||
"bool": lambda v: v.lower() == "true",
|
||||
"int": int,
|
||||
"str": str
|
||||
}[t](value)
|
||||
else:
|
||||
# Handle value being a dictionary
|
||||
value = ast.literal_eval(value)
|
||||
|
||||
config = util.load_config(install.CONFIG_FILE_PATH)
|
||||
if journal:
|
||||
config = config["journals"][journal]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue