From 1410477fe9ac0f6126b6954963862c945d51fa0c Mon Sep 17 00:00:00 2001 From: Tod Beardsley Date: Mon, 26 Jan 2015 17:00:45 -0600 Subject: [PATCH] Use the blank password/username variables --- .../ui/console/command_dispatcher/db_spec.rb | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/spec/lib/msf/ui/console/command_dispatcher/db_spec.rb b/spec/lib/msf/ui/console/command_dispatcher/db_spec.rb index bd76b2fb44..4eba59d1fc 100644 --- a/spec/lib/msf/ui/console/command_dispatcher/db_spec.rb +++ b/spec/lib/msf/ui/console/command_dispatcher/db_spec.rb @@ -92,6 +92,14 @@ describe Msf::Ui::Console::CommandDispatcher::Db do public: blank_pub, realm: nil, workspace: framework.db.workspace) + nonblank_pub = FactoryGirl.create(:metasploit_credential_username, username: nonblank_username) + blank_priv = FactoryGirl.create(:metasploit_credential_password, data: blank_password) + core = FactoryGirl.create(:metasploit_credential_core, + origin: FactoryGirl.create(:metasploit_credential_origin_import), + private: blank_priv, + public: nonblank_pub, + realm: nil, + workspace: framework.db.workspace) end context "when the credential is present" do it "should show a user that matches the given expression" do @@ -107,7 +115,7 @@ describe Msf::Ui::Console::CommandDispatcher::Db do end context "and when the username is blank" do it "should show a user that matches the given expression" do - db.cmd_creds("-u", "") + db.cmd_creds("-u", blank_username ) @output.should =~ [ "Credentials", "===========", @@ -118,6 +126,19 @@ describe Msf::Ui::Console::CommandDispatcher::Db do ] end end + context "and when the password is blank" do + it "should show a user that matches the given expression" do + db.cmd_creds("-P", blank_password ) + @output.should =~ [ + "Credentials", + "===========", + "", + "host service public private realm private_type", + "---- ------- ------ ------- ----- ------------", + " nonblank_user Password" + ] + end + end end context "when the credential is absent" do it "should return a blank set" do @@ -132,6 +153,7 @@ describe Msf::Ui::Console::CommandDispatcher::Db do end end end + describe "add-password" do let(:username) { "username" } let(:password) { "password" }