Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 5db7079d authored by Jonathan Pastor's avatar Jonathan Pastor
Browse files

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

parent d995c3fb
No related branches found
No related tags found
No related merge requests found
Pipeline #94503 failed
Showing
with 19685 additions and 0 deletions
...@@ -9,3 +9,5 @@ gem "dns-zone" ...@@ -9,3 +9,5 @@ gem "dns-zone"
gem "ruby-cute", :require => "cute" gem "ruby-cute", :require => "cute"
gem "peach" gem "peach"
gem "restfully" 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" : []
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment