PageRenderTime 49ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/test/unit/ini_parser_test.rb

http://ovz-web-panel.googlecode.com/
Ruby | 34 lines | 27 code | 6 blank | 1 comment | 0 complexity | ff0930f0e564a33fb077a64cce5aa12f MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0
  1. require 'test_helper'
  2. class IniParserTest < ActiveSupport::TestCase
  3. def setup
  4. config = <<-EOS
  5. TEMPLATE=/var/lib/vz/template
  6. VE_PRIVATE=/var/lib/vz/private/$VEID
  7. CONFIGFILE="vps.basic"
  8. # line with comments
  9. NEIGHBOUR_DEVS = detect
  10. VZFASTBOOT = "no"
  11. VE0CPUUNITS=1000
  12. IPV6="no"
  13. EOS
  14. @parser = IniParser.new(config)
  15. end
  16. test "Read value by key" do
  17. assert_equal '/var/lib/vz/template', @parser.get('TEMPLATE')
  18. assert_equal '/var/lib/vz/private/$VEID', @parser.get('VE_PRIVATE')
  19. assert_equal 'vps.basic', @parser.get('CONFIGFILE')
  20. assert_equal 'detect', @parser.get('NEIGHBOUR_DEVS')
  21. assert_equal 'no', @parser.get('VZFASTBOOT')
  22. assert_equal 'no', @parser.get('IPV6')
  23. assert_equal 1000, @parser.get('VE0CPUUNITS').to_i
  24. end
  25. test "Read non-existent key" do
  26. assert_nil @parser.get('NO_KEY')
  27. end
  28. end