Commit 5db7079d authored by Jonathan Pastor's avatar Jonathan Pastor

first step toward an RSPEC test that tests the new generator for oar-properties

parent d995c3fb
Pipeline #94503 failed with stages
in 2 minutes and 10 seconds
......@@ -9,3 +9,5 @@ gem "dns-zone"
gem "ruby-cute", :require => "cute"
gem "peach"
gem "restfully"
gem "rspec"
gem "webmock"
require 'rspec'
require 'webmock/rspec'
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '../lib')))
require 'refrepo'
WebMock.disable_net_connect!(allow_localhost: true)
conf = RefRepo::Utils.get_api_config
def load_stub_file_content(stub_filename)
if not File.exist?("stub_oar_properties/#{stub_filename}")
raise("Cannot find #{stub_filename} in 'stub_oar_properties/'")
end
file = File.open("stub_oar_properties/#{stub_filename}", "r")
lines = IO.read(file)
file.close()
return lines
end
describe 'Oar properties generator' do
context 'Empty OAR server' do
before do
stubbed_api_response = load_stub_file_content("fakesite_from_scratch_do_diff-1.json")
stub_request(:get, conf["uri"]).
with(headers: {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
to_return(status: 200, body: stubbed_api_response, headers: {})
end
it 'should generate correctly' do
uri = URI(conf["uri"])
response = Net::HTTP.get(uri)
expect(response).to be_an_instance_of(String)
end
end
context 'OAR server with data' do
before do
stubbed_api_response = load_stub_file_content("fakesite_from_scratch_do_update-1.json")
stub_request(:get, conf["uri"]).
with(headers: {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
to_return(status: 200, body: stubbed_api_response, headers: {})
end
it 'should generate correctly' do
uri = URI(conf["uri"])
response = Net::HTTP.get(uri)
expect(response).to be_an_instance_of(String)
end
end
end
\ No newline at end of file
{
"links" : [],
"total" : 0,
"items" : [],
"offset" : 0
}
{
"links" : [],
"total" : 0,
"items" : [],
"offset" : 0
}
{
"total" : 0,
"offset" : 0,
"items" : [],
"links" : []
}
{
"items" : [],
"links" : [],
"total" : 0,
"offset" : 0
}
{
"offset" : 0,
"total" : 0,
"items" : [],
"links" : []
}
{
"total" : 0,
"links" : [],
"items" : [],
"offset" : 0
}
{
"offset" : 0,
"links" : [],
"total" : 0,
"items" : []
}
{
"items" : [],
"offset" : 0,
"total" : 0,
"links" : []
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment