Class: Mu::Xtractr::Flows::Test
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- Mu::Xtractr::Flows::Test
- Defined in:
- lib/mu/xtractr/test/tc_flows.rb
Instance Attribute Summary collapse
-
#xtractr ⇒ Object
readonly
Returns the value of attribute xtractr.
Instance Method Summary collapse
- #setup ⇒ Object
- #test_count ⇒ Object
- #test_each ⇒ Object
- #test_first ⇒ Object
- #test_Flows ⇒ Object
- #test_inspect ⇒ Object
- #test_q ⇒ Object
- #test_save ⇒ Object
- #test_sum ⇒ Object
- #test_values ⇒ Object
Instance Attribute Details
#xtractr ⇒ Object (readonly)
Returns the value of attribute xtractr.
22 23 24 |
# File 'lib/mu/xtractr/test/tc_flows.rb', line 22 def xtractr @xtractr end |
Instance Method Details
#setup ⇒ Object
24 25 26 |
# File 'lib/mu/xtractr/test/tc_flows.rb', line 24 def setup @xtractr = Xtractr.new end |
#test_count ⇒ Object
58 59 60 61 62 63 |
# File 'lib/mu/xtractr/test/tc_flows.rb', line 58 def test_count flows = xtractr.flows 'flow.service:DNS' counts = flows.count 'dns.qry.name' assert_equal(4, counts.size) counts.each { |c| assert_kind_of(Views::Count, c) } end |
#test_each ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/mu/xtractr/test/tc_flows.rb', line 40 def test_each flows = xtractr.flows 'flow.service:DNS' v = flows.each { |f| assert_kind_of(Flow, f) } assert_equal(flows, v) v = flows.each_flow { |f| assert_kind_of(Flow, f) } assert_equal(flows, v) end |
#test_first ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/mu/xtractr/test/tc_flows.rb', line 49 def test_first flows = xtractr.flows 'flow.service:DNS' flow = flows.first assert_kind_of(Flow, flow) flow = xtractr.flows('flow.service:blah').first assert_nil(flow) end |
#test_Flows ⇒ Object
28 29 30 |
# File 'lib/mu/xtractr/test/tc_flows.rb', line 28 def test_Flows assert(Flows.ancestors.include?(Enumerable), "Flows doesn't mixin Enumerable") end |
#test_inspect ⇒ Object
88 89 90 |
# File 'lib/mu/xtractr/test/tc_flows.rb', line 88 def test_inspect assert_nothing_raised { xtractr.flows.inspect } end |
#test_q ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/mu/xtractr/test/tc_flows.rb', line 32 def test_q flows = xtractr.flows assert_equal('*', flows.q) flows = xtractr.flows 'flow.service:DNS' assert_equal('flow.service:DNS', flows.q) end |
#test_save ⇒ Object
79 80 81 82 83 84 85 86 |
# File 'lib/mu/xtractr/test/tc_flows.rb', line 79 def test_save filename = '/tmp/foo.pcap' xtractr.flows(1..3).save(filename) assert_equal(true, File.exist?(filename)) assert_equal(20898, File.size(filename)) ensure File.unlink filename end |