File: test_api.py

package info (click to toggle)
organize 3.3.0-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,540 kB
  • sloc: python: 5,837; makefile: 4
file content (24 lines) | stat: -rw-r--r-- 645 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from conftest import make_files

from organize import Config, Rule
from organize.actions import Echo
from organize.filters import Name


def test_api(fs, testoutput):
    make_files(["foo.txt", "bar.txt", "baz.txt"], "test")

    echo = Echo("{name.upper()}{% if name.upper() == 'FOO' %}FOO{% endif %}")

    config = Config(
        rules=[
            Rule(
                name="Say something",
                locations=["/test"],
                filters=[Name()],
                actions=[echo],
            ),
        ]
    )
    config.execute(simulate=False, output=testoutput)
    assert testoutput.messages == ["BAR", "BAZ", "FOOFOO"]