Eclectic Media Git toast / 06ac61b
Bugfixes for shell escaping Ariana Giroux 1 year, 5 months ago
2 changed file(s) with 6 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
3434
3535
3636 def test_parse_command():
37 test_message = _Message('test ! (testing)')
37 test_str = 'test ! (testing)'
38 test_message = _Message(test_str)
3839 result = _parse_command(test_message)
3940
4041 assert type(result) is list
4142 assert len(result) == 3
4243 assert result[0] == 'powershell.exe'
4344 assert result[1] == 'New-BurntToastNotification'
44 assert result[2] == '-Text %s' % quote(str(test_message))
45 assert result[2].count(test_str)
4546
4647
4748 def test_toast(capsys):
3232 """ :param str body: The body of the message
3333 :param str title: The title of the message
3434 """
35 self.title = title
36 self.body = body
35 self.title = quote(title)
36 self.body = quote(body)
3737
3838 def __str__(self):
3939 """ Concaenates the title and body together in the following format:
5858 :rtype: list
5959 """
6060 return ['powershell.exe', 'New-BurntToastNotification',
61 '-Text %s' % quote(str(message))]
61 '-Text %s' % str(message)]
6262
6363
6464 def toast(body, title=''):