def test_from_string_full(self): text = '''<STREAM location="path" cycle="123" cycle_gzip="NO"> <FILTER>gzip</FILTER> <FILTER>bzip2</FILTER> </STREAM>''' log = Stream.from_string(text) right = Stream('path', 123, False, ['gzip', 'bzip2']) self.assertEqual(log, right)
def test_stream(self): text = ''' <STREAM custom="unknown"> abc <UNKNOWN> <CUSTOM /> </UNKNOWN> </STREAM>''' stream = Stream.from_string(text) tree = stream.to_lxml_element() self.assertEqual('unknown', tree.get('custom')) unknown = tree.findall('UNKNOWN') self.assertEqual(1, len(unknown)) unknown = unknown[0] custom = list(unknown) self.assertEqual(1, len(custom)) custom = custom[0] self.assertEqual('CUSTOM', custom.tag)
def test_from_string_filters(self): text = '<STREAM><FILTER>gzip</FILTER><FILTER>bzip2</FILTER></STREAM>' log = Stream.from_string(text) right = Stream(filters=['gzip', 'bzip2']) self.assertEqual(log, right)
def test_from_string_filters(self): text = '<STREAM><FILTER>gzip</FILTER><FILTER>bzip2</FILTER></STREAM>' log = Stream.from_string(text) right = Stream(filters = ['gzip', 'bzip2']) self.assertEqual(log, right)
def test_from_string_location(self): text = '<STREAM location="path" />' log = Stream.from_string(text) right = Stream(location='path') self.assertEqual(log, right)
def test_to_string_filters(self): log = Stream(filters=['gzip', 'bzip2']) copy = Stream.from_string(str(log)) self.assertEqual(log, copy)
def test_to_string_cycle(self): log = Stream(cycle=123) copy = Stream.from_string(str(log)) self.assertEqual(log, copy)
def test_to_string_full(self): log = Stream('path', 123, False, ['gzip', 'bzip2']) copy = Stream.from_string(str(log)) self.assertEqual(log, copy)
def test_to_string_filters(self): log = Stream(filters = ['gzip', 'bzip2']) copy = Stream.from_string(str(log)) self.assertEqual(log, copy)
def test_to_string_cycle_gzip(self): log = Stream(cycle_gzip = False) copy = Stream.from_string(str(log)) self.assertEqual(log, copy)
def test_to_string_cycle(self): log = Stream(cycle = 123) copy = Stream.from_string(str(log)) self.assertEqual(log, copy)
def test_to_string_location(self): log = Stream(location = 'path') copy = Stream.from_string(str(log)) self.assertEqual(log, copy)
def test_to_string(self): log = Stream() copy = Stream.from_string(str(log)) self.assertEqual(log, copy)
def test_to_string_location(self): log = Stream(location='path') copy = Stream.from_string(str(log)) self.assertEqual(log, copy)
def test_from_string(self): text = '<STREAM />' log = Stream.from_string(text) right = Stream() self.assertEqual(log, right)
def test_to_string_cycle_gzip(self): log = Stream(cycle_gzip=False) copy = Stream.from_string(str(log)) self.assertEqual(log, copy)
def test_from_string_location(self): text = '<STREAM location="path" />' log = Stream.from_string(text) right = Stream(location = 'path') self.assertEqual(log, right)
def test_from_string_cycle(self): text = '<STREAM cycle="123" />' log = Stream.from_string(text) right = Stream(cycle = 123) self.assertEqual(log, right)
def test_from_string_cycle_gzip(self): text = '<STREAM cycle_gzip="NO" />' log = Stream.from_string(text) right = Stream(cycle_gzip=False) self.assertEqual(log, right)
def test_from_string_cycle(self): text = '<STREAM cycle="123" />' log = Stream.from_string(text) right = Stream(cycle=123) self.assertEqual(log, right)
def test_from_string_cycle_gzip(self): text = '<STREAM cycle_gzip="NO" />' log = Stream.from_string(text) right = Stream(cycle_gzip = False) self.assertEqual(log, right)