Skip to content

Commit

Permalink
Add QRcode extension unit test stub
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoles committed Sep 9, 2015
1 parent 9a0a361 commit 091841f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
46 changes: 46 additions & 0 deletions test/unit/extensions/tc_qrcode.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#
# Copyright (c) 2006-2015 Wade Alcorn - [email protected]
# Browser Exploitation Framework (BeEF) - http://beefproject.com
# See the file 'doc/COPYING' for copying permission
#
require 'test/unit'

class TC_Qrcode < Test::Unit::TestCase

class << self

def startup
$root_dir = '../../'
$:.unshift(File.expand_path($root_dir))

# load extension
require 'extensions/qrcode/extension'

# load config
BeEF::Core::Configuration.new(File.join($root_dir, 'config.yaml'))
config = BeEF::Core::Configuration.instance
config.load_extensions_config
@@qrcode_config = config.get('beef.extension.qrcode')
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(@@qrcode_config.has_key?('enable'))
assert(@@qrcode_config.has_key?('targets'))
assert(@@qrcode_config.has_key?('qrsize'))
assert(@@qrcode_config.has_key?('qrborder'))
end

end
2 changes: 2 additions & 0 deletions test/unit/ts_unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
require './extensions/tc_requester'
require './extensions/tc_event_logger'
require './extensions/tc_network'
require './extensions/tc_qrcode'
#require './extensions/tc_dns'
require './tc_grep'
require './tc_filesystem'
Expand All @@ -53,6 +54,7 @@ def self.suite
suite << TC_Proxy.suite
suite << TC_EventLogger.suite
suite << TC_Network.suite
suite << TC_Qrcode.suite
suite << TC_Hooks.suite
suite << TC_Redirector.suite
suite << TC_DynamicReconstruction.suite
Expand Down

0 comments on commit 091841f

Please sign in to comment.