Add console unit test stub
This commit is contained in:
46
test/unit/extensions/tc_console.rb
Normal file
46
test/unit/extensions/tc_console.rb
Normal file
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# Copyright (c) 2006-2015 Wade Alcorn - wade@bindshell.net
|
||||
# Browser Exploitation Framework (BeEF) - http://beefproject.com
|
||||
# See the file 'doc/COPYING' for copying permission
|
||||
#
|
||||
require 'test/unit'
|
||||
|
||||
class TC_Console < Test::Unit::TestCase
|
||||
|
||||
class << self
|
||||
|
||||
def startup
|
||||
$root_dir = '../../'
|
||||
$:.unshift(File.expand_path($root_dir))
|
||||
|
||||
# load extension
|
||||
require 'extensions/console/extension'
|
||||
|
||||
# load config
|
||||
BeEF::Core::Configuration.new(File.join($root_dir, 'config.yaml'))
|
||||
config = BeEF::Core::Configuration.instance
|
||||
config.load_extensions_config
|
||||
@@console_config = config.get('beef.extension.console')
|
||||
@@console_config_shell = config.get('beef.extension.console.shell')
|
||||
end
|
||||
|
||||
def shutdown
|
||||
$root_dir = nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Connects to in-memory database (does not test anything)
|
||||
def test_01_database
|
||||
DataMapper.setup(:default, 'sqlite3::memory:')
|
||||
DataMapper.auto_migrate!
|
||||
end
|
||||
|
||||
# Checks for required settings in config file
|
||||
def test_02_config
|
||||
assert(@@console_config.has_key?('enable'))
|
||||
assert(@@console_config_shell.has_key?('historyfolder'))
|
||||
assert(@@console_config_shell.has_key?('historyfile'))
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user