mirror of
https://github.com/cmur2/openvpn-status-web.git
synced 2025-06-29 10:30:23 +02:00
Add some parser tests
This commit is contained in:
23
spec/parser/modern_stateless_spec.rb
Normal file
23
spec/parser/modern_stateless_spec.rb
Normal file
@ -0,0 +1,23 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe OpenVPNStatusWeb::Parser::ModernStateless do
|
||||
{
|
||||
2 => status_v2,
|
||||
3 => status_v3
|
||||
}.each do |version, status|
|
||||
context "for status-version #{version}" do
|
||||
it 'parses client list' do
|
||||
status.client_list.map { |client| client[0] }.should be_eql ["foo", "bar"]
|
||||
end
|
||||
|
||||
it 'parses routing table' do
|
||||
status.routing_table.map { |route| route[1] }.should be_eql ["foo", "bar", "foo", "bar"]
|
||||
end
|
||||
|
||||
it 'parses global stats' do
|
||||
status.global_stats.size.should be_eql 1
|
||||
status.global_stats.first.should be_eql ["Max bcast/mcast queue length", "42"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
18
spec/parser/v1_spec.rb
Normal file
18
spec/parser/v1_spec.rb
Normal file
@ -0,0 +1,18 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe OpenVPNStatusWeb::Parser::V1 do
|
||||
def status; status_v1; end
|
||||
|
||||
it 'parses client list' do
|
||||
status.client_list.map { |client| client[0] }.should be_eql ["foo", "bar"]
|
||||
end
|
||||
|
||||
it 'parses routing table' do
|
||||
status.routing_table.map { |route| route[1] }.should be_eql ["foo", "bar", "foo", "bar"]
|
||||
end
|
||||
|
||||
it 'parses global stats' do
|
||||
status.global_stats.size.should be_eql 1
|
||||
status.global_stats.first.should be_eql ["Max bcast/mcast queue length", "42"]
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user