Brett Smith
d9dca2cd68
data: Posting.is_payment casts threshold to address typing issue.
2020-03-29 15:32:51 -04:00
Brett Smith
d8c7242208
meta_approval: Pass configured payment_threshold to is_payment.
2020-03-29 14:41:57 -04:00
Brett Smith
043644d194
meta_approval: Start hook.
2020-03-29 11:14:51 -04:00
Brett Smith
30d371278a
plugin: Refactor hooks to use new payment-related methods.
2020-03-29 10:30:54 -04:00
Brett Smith
5f85d9c747
config: Add Config.payment_threshold() method.
...
This just returns a constant for now, but we know it may need to be
configurable in the future. Other code can start using this now
to be configurable in the future.
2020-03-29 10:21:37 -04:00
Brett Smith
93feb2f4a3
data: Add Posting.is_payment() method.
2020-03-29 10:18:51 -04:00
Brett Smith
2909c405e6
meta_receipt: Start hook.
2020-03-28 22:19:49 -04:00
Brett Smith
7658aaedf8
plugin: Refactor _RequireLinksPostingMetadataHook out of MetaInvoice.
...
This will be a common hook type.
2020-03-28 14:48:49 -04:00
Brett Smith
d9420ac2b6
meta_invoice: Start hook.
2020-03-28 14:31:17 -04:00
Brett Smith
f996139070
tests: Test Metadata.get_links() with whitespace on one side.
2020-03-28 13:38:18 -04:00
Brett Smith
46cfc558ec
plugin: Link checkers use Metadata class.
2020-03-28 13:36:56 -04:00
Brett Smith
9b63d898af
data: Add Metadata class.
...
As I start writing more link-checking hooks, I want a common place to
write link-parsing code. This new class will be that place.
2020-03-28 13:35:38 -04:00
Brett Smith
2cb131423f
errors: Redo InvalidMetadataError.
...
This needs to be generally usable for transactions.
2020-03-28 09:47:40 -04:00
Brett Smith
33cb734b19
config: Create cache database files with 0o600 mode.
...
I wasn't too worried about this earlier because the cache mainly stores
a bunch of numbers, but there's a little more than that: the generated
URLs also include original attachment filenames, which might be sensitive
(referencing people's names, bank names, etc.). Tighten security
accordingly.
2020-03-27 10:55:30 -04:00
Brett Smith
a8407c7b6a
rtutil: Add RTLinkCache class to cache links to disk.
...
This will greatly reduce RT requests across multiple runs
and speed up link checking/conversion.
2020-03-27 07:35:45 -04:00
Brett Smith
f227593655
tests: New RT client classes start with seeded ticket data.
...
This reduces the amount of setup many tests need to do before they modify
the ticket data.
2020-03-25 15:24:32 -04:00
Brett Smith
1155212376
config: Add Config.cache_dir_path method.
2020-03-25 15:15:38 -04:00
Brett Smith
96ef7c9cbb
test_config: Make update_environ more robust against failures.
2020-03-25 14:04:47 -04:00
Brett Smith
d8b0a56fb4
tests: Set a default CONSERVANCY_REPOSITORY for testing.
2020-03-25 14:03:25 -04:00
Brett Smith
91a436abd5
testutil: Fix missing return
typo.
2020-03-25 10:50:50 -04:00
Brett Smith
e8e7137216
rtutil: Fix parsing server URLs that include /REST/.
2020-03-25 10:18:09 -04:00
Brett Smith
a3630ab04e
rtutil: Add docstring with basic rationale.
2020-03-25 10:18:01 -04:00
Brett Smith
2fb7826ab4
rtutil: Clean unused code.
2020-03-25 10:12:50 -04:00
Brett Smith
a61b74308f
rtutil: Make RT.parse a classmethod.
...
Because it works, and I can imagine it being useful to have this
method more handy to other code.
2020-03-25 00:13:18 -04:00
Brett Smith
4874a107e8
meta_rt_links: Start hook.
2020-03-25 00:12:20 -04:00
Brett Smith
c4ce59da75
config: Add Config.rt_wrapper method.
...
This returns a cached version of the new rtutil.RT class,
so that a single process can easily grab references to one
instance with one cache of ticket/attachment data, etc.
2020-03-24 23:30:31 -04:00
Brett Smith
9fbc658aa6
rtutil: Add RT.parse method.
...
This method can parse the ticket and (optional) attachment IDs
out of our short-hand link formats, both for Ledger and Beancount.
2020-03-24 18:24:31 -04:00
Brett Smith
d5a6141f6d
rtutil: Start module.
...
For now, this is basically the Python version of
ledger-tag-convert.plx. It knows how to create RT web links from
ticket and attachment IDs. It confirms that those objects actually
exist too. It may grow to encompass other functionality in the
future.
2020-03-24 17:23:54 -04:00
Brett Smith
d49173725a
tests: Ignore the DeprecationWarning from the socks module.
...
The socks package in Debian buster does a deprecated import from
the collections module. That's not directly relevant to our own
code (Conservancy has no business requirement for SOCKS support)
so ignore it.
2020-03-24 09:16:38 -04:00
Brett Smith
f09f029fc4
config: Add Config.rt_client method.
2020-03-24 09:08:08 -04:00
Brett Smith
8d3816a8fd
config: Add Config.rt_credentials method.
...
This loads settings from the same environment variables and ~/.rtrc
file as the rt CLI.
Note that it does *not* support RTCONFIG and the config file
searching, because right now that seems like more work for more
trouble to me.
2020-03-23 15:19:15 -04:00
Brett Smith
5140ca64f6
tests: Clean the environment before running tests.
...
As we start reading more sensitive user configuration (like RT credentials),
this fixture makes it simpler to ensure that the tests never read the user's
real configuration, which could lead to problems like passwords in tracebacks.
2020-03-23 12:01:02 -04:00
Brett Smith
d845332c7e
meta_entity: Clean unused imports.
2020-03-21 13:55:42 -04:00
Brett Smith
ad268f049d
meta_entity: Start hook.
2020-03-21 13:53:33 -04:00
Brett Smith
5c6043311b
meta_repo_links: Start hook.
2020-03-20 16:47:06 -04:00
Brett Smith
1500d2d9d8
meta_project: Start hook.
2020-03-20 12:08:10 -04:00
Brett Smith
0d370c445b
plugin: User configuration is passed to hooks on initialization.
2020-03-19 17:23:27 -04:00
Brett Smith
84d8adb7f6
plugin: Move hook initialization from HookRegistry to run().
...
Makes more sense here so run can report errors in hook configuration.
2020-03-19 16:42:13 -04:00
Brett Smith
e424173216
test_plugin: Restore negative assert to test_registry_group_by_directive.
2020-03-19 16:11:29 -04:00
Brett Smith
484c47a680
test_plugin: Parametrize HookRegistry.group_by_directive tests.
2020-03-19 16:00:22 -04:00
Brett Smith
d4d9bd6554
tests: Test HookRegistry using test instance, not real one.
...
This is better testing praxis and more prep for hooks-get-config.
2020-03-19 15:49:56 -04:00
Brett Smith
501bd251cb
tests: Turn tested hooks into fixtures.
...
This is in preparation for passing configuration to hooks.
That'll be a big change already, so I wanted this to be a
boring diff first.
2020-03-19 15:04:53 -04:00
Brett Smith
71531913d5
config: Start module.
...
Ultimately all values that come from user configuration will be generated
here.
2020-03-19 14:31:21 -04:00
Brett Smith
a78db2ed36
data: Add docstrings.
2020-03-19 12:19:34 -04:00
Brett Smith
4fee91ad48
data.Account: Use multi-arg is_under in is_real_asset.
2020-03-19 10:43:20 -04:00
Brett Smith
7cd569be7b
data.Account: Add is_income method.
2020-03-19 10:23:55 -04:00
Brett Smith
b7089f5ddf
plugin: Add meta_income_type validator.
2020-03-19 09:52:43 -04:00
Brett Smith
9b8563f3f0
data.Account: is_under accepts multiple arguments.
2020-03-19 09:47:10 -04:00
Brett Smith
f1c115de49
testutil: Improve check_post_meta error reporting.
...
This version makes it easier to get diffs between the expected
and actual metadata.
2020-03-19 09:32:06 -04:00
Brett Smith
cbd94d9b75
core: Make MetadataEnum aliases optional.
2020-03-18 18:23:42 -04:00