Add a basic python spec file

This commit is contained in:
Spencer McIntyre 2022-02-13 13:32:03 -05:00
parent 683d4ac471
commit 0f46eb12a7
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
require 'spec_helper'
RSpec.describe Msf::Payload::Python do
describe '#create_exec_stub' do
let(:python_code) { 'print("hello world");' }
it 'does not include double quotes' do
# some usages of this method make this assumption and breaking it would create problems
expect(described_class.create_exec_stub(python_code)).to_not include('"')
end
it 'does not include spaces' do
expect(described_class.create_exec_stub(python_code)).to_not include(' ')
end
it 'does not include semicolons' do
# this makes sure that the result is a single expression, not a series of statements
expect(described_class.create_exec_stub(python_code)).to_not include(';')
end
end
end