CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/spec/lib/rex/proto/nuuo/response_spec.rb
Views: 11788
1
# -*- coding:binary -*-
2
3
RSpec.describe Rex::Proto::Nuuo::Response do
4
subject(:response) {described_class.new}
5
let(:header) {'Header'}
6
let(:hvalue) {'Value'}
7
let(:body) {'test'}
8
let(:data) {"NUCM/1.0 200\r\n#{header}:#{hvalue}\r\nContent-Length:4\r\n\r\n#{body}"}
9
10
describe '#parse' do
11
it 'returns a ParseCode' do
12
expect(response.parse(data)).to eq(Rex::Proto::Nuuo::Response::ParseCode::Completed)
13
end
14
15
it 'sets the headers' do
16
response.parse(data)
17
expect(response.headers[header]).to eq(hvalue)
18
end
19
20
it 'sets the body' do
21
response.parse(data)
22
expect(response.body).to eq(body)
23
end
24
end
25
end
26
27