summaryrefslogtreecommitdiff
path: root/test/tests/plugin-dir.bash
blob: 299f144053241f97750226076a85e2325ba203c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
test_description='directory-based plugin loading works'
. '../test-lib.bash'

test_expect_success 'setup' '
mkdir ${DOTFILES}/plugins
cat > ${DOTFILES}/plugins/test.py <<EOF
import dotbot
import os.path

class Test(dotbot.Plugin):
    def can_handle(self, directive):
        return directive == "test"

    def handle(self, directive, data):
        with open(os.path.expanduser("~/flag"), "w") as f:
            f.write("it works")
        return True
EOF
'

test_expect_success 'run' '
run_dotbot --plugin-dir plugins <<EOF
- test: ~
EOF
'

test_expect_success 'test' '
grep "it works" ~/flag
'