You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.7 KiB
58 lines
1.7 KiB
import pytest
|
|
from scripttease.exceptions import InvalidInput
|
|
from scripttease.lib.commands.messages import *
|
|
|
|
|
|
def test_dialog():
|
|
c = dialog("This is a test.", title="Testing")
|
|
s = c.get_statement(include_comment=False)
|
|
# dialog --clear --backtitle "Testing" --msgbox "This is a test." 15 100; clear;
|
|
assert 'dialog --clear --backtitle "Testing"' in s
|
|
assert '--msgbox "This is a test." 15 100; clear;'
|
|
|
|
|
|
def test_echo():
|
|
c = echo("This is a test.")
|
|
s = c.get_statement(include_comment=False)
|
|
assert "echo" in s
|
|
assert "This is a test." in s
|
|
|
|
|
|
def test_explain():
|
|
assert explain("this is a test") is not None
|
|
|
|
|
|
def test_mattermost():
|
|
|
|
with pytest.raises(InvalidInput):
|
|
mattermost("This is a test.")
|
|
|
|
c = mattermost("This is a test.", url="https://example.mattermost.com/asdf/1234")
|
|
s = c.get_statement(include_comment=False)
|
|
|
|
assert "curl -X POST -H 'Content-type: application/json' --data" in s
|
|
assert "This is a test." in s
|
|
assert "https://example.mattermost.com/asdf/1234" in s
|
|
|
|
def test_screenshot():
|
|
assert screenshot("static/images/testing.png") is not None
|
|
|
|
|
|
def test_slack():
|
|
with pytest.raises(InvalidInput):
|
|
slack("This is a test.")
|
|
|
|
c = slack("This is a test.", url="https://example.slack.com/asdf/1234")
|
|
s = c.get_statement(include_comment=False)
|
|
assert "curl -X POST -H 'Content-type: application/json' --data" in s
|
|
assert "This is a test." in s
|
|
assert "https://example.slack.com/asdf/1234" in s
|
|
|
|
|
|
def test_twist():
|
|
with pytest.raises(InvalidInput):
|
|
twist("This is a test.")
|
|
|
|
c = twist("This is a test.", url="https://example.twist.com/asdf/1234")
|
|
s = c.get_statement(include_comment=False)
|
|
print(s)
|
|
|