Changeset - 5f85d9c74776
[Not reviewed]
0 2 0
Brett Smith - 4 years ago 2020-03-29 14:21:37
brettcsmith@brettcsmith.org
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.
2 files changed with 10 insertions and 0 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/config.py
Show inline comments
...
 
@@ -14,6 +14,7 @@
 
# You should have received a copy of the GNU Affero General Public License
 
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
 

	
 
import decimal
 
import functools
 
import os
 
import urllib.parse as urlparse
...
 
@@ -86,6 +87,9 @@ class Config:
 
            and self._dir_or_none(cache_root / name)
 
        )
 

	
 
    def payment_threshold(self) -> decimal.Decimal:
 
        return decimal.Decimal(0)
 

	
 
    def repository_path(self) -> Optional[Path]:
 
        try:
 
            return Path(os.environ['CONSERVANCY_REPOSITORY'])
tests/test_config.py
Show inline comments
...
 
@@ -15,6 +15,7 @@
 
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
 

	
 
import contextlib
 
import decimal
 
import os
 
import re
 

	
...
 
@@ -281,3 +282,8 @@ def test_cache_path_parent_conflict(tmp_path):
 
    with update_environ(HOME=tmp_path, XDG_CACHE_DIR=None):
 
        config = config_mod.Config()
 
        assert config.cache_dir_path('TESTcache') is None
 

	
 
def test_payment_threshold():
 
    threshold = config_mod.Config().payment_threshold()
 
    assert threshold == 0
 
    assert isinstance(threshold, (int, decimal.Decimal))
0 comments (0 inline, 0 general)