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)
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')
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')
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')
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')