示例#1
0
 def test_write_jbos_shell(self):
     out = Writer(StringIO())
     s = safe_str.jbos('$foo', safe_str.escaped_str('$bar'))
     out.write(s, Syntax.shell)
     if platform_name() == 'windows':
         expected = '$$foo$bar'
     else:
         expected = quoted('$$foo') + '$bar'
     self.assertEqual(out.stream.getvalue(), expected)
示例#2
0
 def test_write_jbos_clean(self):
     out = Writer(StringIO())
     s = safe_str.jbos('$foo', safe_str.escaped_str('$bar'))
     out.write(s, Syntax.clean)
     self.assertEqual(out.stream.getvalue(), '$$foo$bar')
示例#3
0
 def test_write_jbos_shell(self):
     out = Writer(StringIO())
     s = safe_str.jbos('$foo', safe_str.escaped_str('$bar'))
     out.write(s, Syntax.shell)
     self.assertEqual(out.stream.getvalue(), quoted('$$foo') + '$bar')
示例#4
0
 def test_write_escaped_string_clean(self):
     out = Writer(StringIO())
     out.write(safe_str.escaped_str('foo: $bar'), Syntax.clean)
     self.assertEqual(out.stream.getvalue(), 'foo: $bar')
示例#5
0
 def test_write_escaped_string_shell(self):
     out = Writer(StringIO())
     out.write(safe_str.escaped_str('foo: $bar|baz,quux'), Syntax.shell)
     self.assertEqual(out.stream.getvalue(), 'foo: $bar|baz,quux')