Skip to content

Commit

Permalink
fix various test problems
Browse files Browse the repository at this point in the history
  • Loading branch information
jettero committed Dec 9, 2022
1 parent f0ea8ee commit 8dddb46
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions t/test_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@
# coding: utf-8

import pytest
from ldogger.args import get_arg_parser
from ldogger.args import get_ldogger_arg_parser


def test_parse_args_and_process_first_pass():
p = get_arg_parser()
p = get_ldogger_arg_parser()

a0 = p.parse_args(["--meta", "test1=1"])
a1 = p.process("--meta", "test1=1")

assert hasattr(a0, "meta") and a0.meta == {"test1": 1}
assert hasattr(a1, "meta") and a1.meta == {"test1": 1}
assert hasattr(a0, "meta") and a0.meta == {"test1": "1"}
assert hasattr(a1, "meta") and a1.meta == {"test1": "1"}


def test_process():
p = get_arg_parser()
p = get_ldogger_arg_parser()

a0 = p.process("--meta test1=1 --meta test2=2")
assert a0.meta == {"test1": 1, "test2": 2}
assert a0.meta == {"test1": "1", "test2": "2"}

a1 = a0.reprocess("--meta test3=3")
assert a1.meta == {"test1": 1, "test2": 2, "test3": 3}
assert a1.meta == {"test1": "1", "test2": "2", "test3": "3"}

a2 = a0.reprocess("--meta test4=4")
assert a2.meta == {"test1": 1, "test2": 2, "test4": 4}
assert a2.meta == {"test1": "1", "test2": "2", "test4": "4"}

d0 = a0.as_dict()
d1 = a1.as_dict()
Expand All @@ -35,7 +35,7 @@ def test_process():


def test_stupid_reprocess_args():
p = get_arg_parser()
p = get_ldogger_arg_parser()
a0 = p.process()
with pytest.raises(SystemExit) as exc:
a0.reprocess("--help")
Expand Down
4 changes: 2 additions & 2 deletions t/test_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


import os
import logdna.dispatch as d
import ldogger.dispatch as d


def test_headers():
Expand All @@ -18,4 +18,4 @@ def test_url():
assert url == "https://logs.logdna.com/logs/ingest?hostname=white-rabit&now=94712411"

url = d.gen_url(hostname="white-rabit", tags=["supz", "mang"], now=94712417)
assert url == "https://logs.logdna.com/logs/ingest?hostname=white-rabit&tags=supz,mang&now=94712417"
assert url == "https://logs.logdna.com/logs/ingest?hostname=white-rabit&tags=mang,supz&now=94712417"

0 comments on commit 8dddb46

Please sign in to comment.