Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions tests/helpers/util.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
""" Utility functions for tests
"""
"""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
"""
"""Helper function to parse test args"""
ap = setup_argparse()
args = ap.parse_args(testargv)
if tomldata is not None:
Expand Down
3 changes: 1 addition & 2 deletions tests/test_allowlist.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
""" Test allowlists
"""
"""Test allowlists"""

import pytest
from util import shim_argparse
Expand Down
3 changes: 1 addition & 2 deletions tests/test_cmdline.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Test the commandline defined parameters correctly
"""
"""Test the commandline defined parameters correctly"""

from fediblockhole import setup_argparse

Expand Down
15 changes: 5 additions & 10 deletions tests/test_configfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Test the config file is loading parameters correctly
"""
"""Test the config file is loading parameters correctly"""

from textwrap import dedent

Expand Down Expand Up @@ -95,16 +94,14 @@ def test_set_merge_thresold_pct():


def test_destination_token_from_environment(monkeypatch):
tomldata = dedent(
"""\
tomldata = dedent("""\
blocklist_instance_destinations = [
{ domain='example.com', token='raw-token'},
{ domain='example2.com', token_env_var='TOKEN_ENV_VAR' },
{ domain='env-token.com' },
{ domain='www.env-token.com' },
]
"""
)
""")

monkeypatch.setenv("TOKEN_ENV_VAR", "env-token")
monkeypatch.setenv("ENV-TOKEN_COM_TOKEN", "env-token")
Expand All @@ -119,16 +116,14 @@ def test_destination_token_from_environment(monkeypatch):


def test_instance_sources_token_from_environment(monkeypatch):
tomldata = dedent(
"""\
tomldata = dedent("""\
blocklist_instance_sources = [
{ domain='example.com', token='raw-token'},
{ domain='example2.com', token_env_var='TOKEN_ENV_VAR' },
{ domain='env-token.com' },
{ domain='www.env-token.com' },
]
"""
)
""")

monkeypatch.setenv("TOKEN_ENV_VAR", "env-token")
monkeypatch.setenv("ENV-TOKEN_COM_TOKEN", "env-token")
Expand Down
3 changes: 1 addition & 2 deletions tests/test_domainblock.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Test the DomainBlock structure
"""
"""Test the DomainBlock structure"""

import pytest

Expand Down
3 changes: 1 addition & 2 deletions tests/test_merge_comments.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
""" Test merging of comments
"""
"""Test merging of comments"""

from fediblockhole import merge_comments

Expand Down
3 changes: 1 addition & 2 deletions tests/test_merge_thresholds.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Test merge with thresholds
"""
"""Test merge with thresholds"""

from fediblockhole import merge_blocklists
from fediblockhole.blocklists import Blocklist, parse_blocklist
Expand Down
3 changes: 1 addition & 2 deletions tests/test_mergeplan.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Various mergeplan tests
"""
"""Various mergeplan tests"""

from fediblockhole import apply_mergeplan, merge_blocklists, merge_comments
from fediblockhole.blocklists import parse_blocklist
Expand Down
3 changes: 1 addition & 2 deletions tests/test_parser_csv.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Tests of the CSV parsing
"""
"""Tests of the CSV parsing"""

from fediblockhole.blocklists import BlocklistParserCSV
from fediblockhole.const import SeverityLevel
Expand Down
3 changes: 1 addition & 2 deletions tests/test_parser_csv_mastodon.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Tests of the CSV parsing
"""
"""Tests of the CSV parsing"""

from fediblockhole.blocklists import BlocklistParserMastodonCSV
from fediblockhole.const import SeverityLevel
Expand Down
3 changes: 1 addition & 2 deletions tests/test_parser_json.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Tests of the CSV parsing
"""
"""Tests of the CSV parsing"""

from fediblockhole.blocklists import BlocklistParserJSON
from fediblockhole.const import SeverityLevel
Expand Down
3 changes: 1 addition & 2 deletions tests/test_parser_rapidblockcsv.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Tests of the Rapidblock CSV parsing
"""
"""Tests of the Rapidblock CSV parsing"""

from fediblockhole.blocklists import RapidBlockParserCSV
from fediblockhole.const import SeverityLevel
Expand Down
3 changes: 1 addition & 2 deletions tests/test_parser_rapidblockjson.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Test parsing the RapidBlock JSON format
"""
"""Test parsing the RapidBlock JSON format"""

from fediblockhole.blocklists import parse_blocklist
from fediblockhole.const import SeverityLevel
Expand Down