Class: Mu::Xtractr::Views::Count::Test
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- Mu::Xtractr::Views::Count::Test
- Defined in:
- lib/mu/xtractr/test/tc_views.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#xtractr ⇒ Object
readonly
Returns the value of attribute xtractr.
Instance Method Summary collapse
- #setup ⇒ Object
- #test_attributes ⇒ Object
- #test_each_packet ⇒ Object
- #test_inspect ⇒ Object
- #test_object ⇒ Object
- #test_packets ⇒ Object
- #test_sum ⇒ Object
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
24 25 26 |
# File 'lib/mu/xtractr/test/tc_views.rb', line 24 def count @count end |
#xtractr ⇒ Object (readonly)
Returns the value of attribute xtractr.
23 24 25 |
# File 'lib/mu/xtractr/test/tc_views.rb', line 23 def xtractr @xtractr end |
Instance Method Details
#setup ⇒ Object
26 27 28 29 |
# File 'lib/mu/xtractr/test/tc_views.rb', line 26 def setup @xtractr = Xtractr.new @count = xtractr.flows('flow.service:DNS').count('dns.qry.name').first end |
#test_attributes ⇒ Object
31 32 33 34 35 |
# File 'lib/mu/xtractr/test/tc_views.rb', line 31 def test_attributes assert_kind_of(Field, count.field) assert_equal('ax.search.itunes.apple.com', count.value) assert_equal(8, count.count) end |
#test_each_packet ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/mu/xtractr/test/tc_views.rb', line 49 def test_each_packet count.each_packet do |pkt| assert_kind_of(Packet, pkt) values = pkt['dns.qry.name'] assert_equal(1, values.size) assert_equal('ax.search.itunes.apple.com', values[0]) end end |
#test_inspect ⇒ Object
63 64 65 |
# File 'lib/mu/xtractr/test/tc_views.rb', line 63 def test_inspect assert_nothing_raised { count.inspect } end |
#test_object ⇒ Object
37 38 39 40 41 42 |
# File 'lib/mu/xtractr/test/tc_views.rb', line 37 def test_object object = count.object assert_kind_of(Field::Value, object) assert_equal('dns.qry.name', object.field.name) assert_equal('ax.search.itunes.apple.com', object.value) end |
#test_packets ⇒ Object
44 45 46 47 |
# File 'lib/mu/xtractr/test/tc_views.rb', line 44 def test_packets packets = count.packets assert_equal("dns.qry.name:\"ax.search.itunes.apple.com\"", packets.q) end |
#test_sum ⇒ Object
58 59 60 61 |
# File 'lib/mu/xtractr/test/tc_views.rb', line 58 def test_sum sums = count.object.sum('pkt.src', 'pkt.length') assert_equal(2, sums.length) end |