Added helper submodule for testing utils
This commit is contained in:
parent
a3d3571a20
commit
bf48a9639e
|
@ -0,0 +1,3 @@
|
|||
import sys
|
||||
import os
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), 'helpers'))
|
|
@ -0,0 +1,11 @@
|
|||
""" Utility functions for tests
|
||||
"""
|
||||
from fediblockhole import setup_argparse, augment_args
|
||||
|
||||
def shim_argparse(testargv: list=[], tomldata: str=None):
|
||||
"""Helper function to parse test args
|
||||
"""
|
||||
ap = setup_argparse()
|
||||
args = ap.parse_args(testargv)
|
||||
args = augment_args(args, tomldata)
|
||||
return args
|
|
@ -1,15 +1,8 @@
|
|||
"""Test the commandline defined parameters correctly
|
||||
"""
|
||||
from util import shim_argparse
|
||||
from fediblockhole import setup_argparse, augment_args
|
||||
|
||||
def shim_argparse(testargv: list=[], tomldata: str=None):
|
||||
"""Helper function to parse test args
|
||||
"""
|
||||
ap = setup_argparse()
|
||||
args = ap.parse_args(testargv)
|
||||
args = augment_args(args, tomldata)
|
||||
return args
|
||||
|
||||
def test_cmdline_no_configfile():
|
||||
""" Test bare command with no configfile
|
||||
"""
|
||||
|
|
|
@ -1,15 +1,8 @@
|
|||
"""Test the config file is loading parameters correctly
|
||||
"""
|
||||
from util import shim_argparse
|
||||
from fediblockhole import setup_argparse, augment_args
|
||||
|
||||
def shim_argparse(testargv: list=[], tomldata: str=None):
|
||||
"""Helper function to parse test args
|
||||
"""
|
||||
ap = setup_argparse()
|
||||
args = ap.parse_args(testargv)
|
||||
args = augment_args(args, tomldata)
|
||||
return args
|
||||
|
||||
def test_parse_tomldata():
|
||||
tomldata = """
|
||||
# Test TOML config for FediBlockHole
|
||||
|
|
Loading…
Reference in New Issue