2016-02-06 13:54:19 -05:00
|
|
|
test_description='plugin loading works'
|
|
|
|
. '../test-lib.bash'
|
|
|
|
|
|
|
|
test_expect_success 'setup' '
|
|
|
|
cat > ${DOTFILES}/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' '
|
2018-05-24 12:00:13 -04:00
|
|
|
run_dotbot --plugin ${DOTFILES}/test.py <<EOF
|
2016-02-06 13:54:19 -05:00
|
|
|
- test: ~
|
|
|
|
EOF
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'test' '
|
|
|
|
grep "it works" ~/flag
|
|
|
|
'
|