Sha256: 8ae869b03d94fca460f66aecc505d8eea2dce695d431b94d7a4f3472a64971ef
Contents?: true
Size: 1.79 KB
Versions: 2
Compression:
Stored size: 1.79 KB
Contents
require 'test_helper' class ServerTest < Minitest::Test include Rack::Test::Methods def app CloudCrowd::Server end context "The CloudCrowd::Server (Sinatra)" do setup do WorkUnit.stubs(:distribute_to_nodes).returns([]) Dispatcher.any_instance.stubs(:distribute_periodically) Job.destroy_all 2.times { Job.make! } end should "set the identity of the Ruby instance" do app.new assert CloudCrowd.server? end should "be able to render the Operations Center (GET /)" do get '/' assert last_response.body.include? '<div id="nodes">' assert last_response.body.include? '<div id="graphs">' end should "be able to get the current status for all jobs (GET /status)" do resp = JSON.parse(get('/status').body) assert resp['job_count'] == 2 assert resp['work_unit_count'] == 2 end should "have a heartbeat" do assert get('/heartbeat').body == 'buh-bump' end should "be able to create a job" do Dispatcher.any_instance.expects(:distribute!) post('/jobs', :job => '{"action":"graphics_magick","inputs":["http://www.google.com/"]}') assert last_response.ok? job_info = JSON.parse(last_response.body) assert job_info['percent_complete'] == 0 assert job_info['work_units'] == 1 assert Job.last.id == job_info['id'] end should "be able to check in on the status of a job" do get("/jobs/#{Job.last.id}") assert last_response.ok? assert JSON.parse(last_response.body)['percent_complete'] == 0 end should "be able to clean up a job when we're done with it" do id = Job.last.id delete("/jobs/#{id}") assert last_response.successful? && last_response.empty? assert !Job.find_by_id(id) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cloud-crowd-0.7.6 | test/acceptance/test_server.rb |
cloud-crowd-0.7.5 | test/acceptance/test_server.rb |