Class: Mu::Xtractr::Stream::HTTP::Test

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/mu/xtractr/test/stream/tc_http.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#flowObject (readonly)

Returns the value of attribute flow.



24
25
26
# File 'lib/mu/xtractr/test/stream/tc_http.rb', line 24

def flow
  @flow
end

#xtractrObject (readonly)

Returns the value of attribute xtractr.



23
24
25
# File 'lib/mu/xtractr/test/stream/tc_http.rb', line 23

def xtractr
  @xtractr
end

Instance Method Details

#setupObject



26
27
28
# File 'lib/mu/xtractr/test/stream/tc_http.rb', line 26

def setup
    @xtractr = Xtractr.new
end

#test_extractObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/mu/xtractr/test/stream/tc_http.rb', line 30

def test_extract
    stream = xtractr.packets('http.content.type:gif').first.flow.stream
    assert_equal(1, stream.contents.size)
    content = stream.contents.first
    assert_nothing_raised { content.inspect }
    assert_equal('image/gif', content.type)
    assert_nil(content.encoding)
    assert_equal('content.4.1', content.name)
    assert_equal(content.message.__id__, stream.messages[1].__id__)
    
    stream = xtractr.packets('http.content.type:xml').first.flow.stream
    assert_equal(1, stream.contents.size)
    content = stream.contents.first
    assert_nothing_raised { content.inspect }
    assert_equal('text/xml', content.type)
    assert_equal('gzip', content.encoding)
    assert_equal('content.2.1', content.name)
    assert_equal(content.message.__id__, stream.messages[1].__id__)
end