PageRenderTime 44ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/rex/service_manager.rb.ut.rb

https://bitbucket.org/technopunk2099/metasploit-framework
Ruby | 33 lines | 24 code | 7 blank | 2 comment | 3 complexity | e42b24a6c89440fb649a2440504e589c MD5 | raw file
Possible License(s): BSD-3-Clause, Apache-2.0, LGPL-2.1, GPL-2.0, MIT
  1. #!/usr/bin/env ruby
  2. # -*- coding: binary -*-
  3. $:.unshift(File.join(File.dirname(__FILE__), '..'))
  4. require 'test/unit'
  5. require 'rex/service_manager'
  6. class Rex::ServiceManager::UnitTest < Test::Unit::TestCase
  7. Klass = Rex::ServiceManager
  8. def test_svcm
  9. begin
  10. c = Klass
  11. s = c.start(Rex::Proto::Http::Server, 8090)
  12. assert_not_nil(s)
  13. t = c.start(Rex::Proto::Http::Server, 8090)
  14. assert_not_nil(t)
  15. assert_equal(s, t)
  16. z = c.start(Rex::Proto::Http::Server, 8091)
  17. assert_not_equal(t, z)
  18. assert_equal("HTTP Server", s.alias)
  19. assert_equal("HTTP Server 1", z.alias)
  20. ensure
  21. c.stop_by_alias(s.alias) if (s)
  22. c.stop_by_alias(z.alias) if (z)
  23. c.stop_by_alias(t.alias) if (t)
  24. end
  25. end
  26. end