Sha256: 2dd2361046fa6c21868f65c2029e1cb6670a0ed82318bcf687a66079f1ef70a1

Contents?: true

Size: 1.34 KB

Versions: 29

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'

describe OpenStudio::Analysis::ServerApi, type: :integration do
  before :all do
    @host = 'http://localhost:8080'
  end

  context 'create and delete a project', type: :api_integration do
    before :all do
      @api = OpenStudio::Analysis::ServerApi.new
      expect(@api.hostname).to eq(@host)
    end

    it 'should create the project' do
      project_id = @api.new_project({})
      expect(project_id).to match /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/

      # get the projects from the api
      project_ids = @api.get_project_ids
      expect(project_ids.include?(project_id)).to eq true

      # delete the project
      r = @api.delete_project project_id
      expect(r).to be true
    end

    it 'should not be able to delete a non-existent project' do
      r = @api.delete_project('not_a_uuid')
      expect(r).to eq false
    end

    it 'create multiple projects and then delete them all' do
      (1..20).each do |_p|
        project_id = @api.new_project({})
        expect(project_id).to match /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/
      end

      r = @api.delete_all
      expect(r).to eq true
    end

    it 'should upload an analysis' do
      puts Dir.pwd
      j = 'spec/files/analysis/medium_office.json'
      z = 'spec/files/analysis/medium_office.zip'
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
openstudio-analysis-1.0.0.rc19 spec/integration/server_api_spec.rb
openstudio-analysis-1.0.0.rc18 spec/integration/server_api_spec.rb
openstudio-analysis-1.0.0.rc17 spec/integration/server_api_spec.rb
openstudio-analysis-1.0.0.rc16 spec/integration/server_api_spec.rb
openstudio-analysis-1.0.0.rc15 spec/integration/server_api_spec.rb
openstudio-analysis-1.0.0.rc14 spec/integration/server_api_spec.rb
openstudio-analysis-1.0.0.rc13 spec/integration/server_api_spec.rb
openstudio-analysis-1.0.0.rc12 spec/integration/server_api_spec.rb
openstudio-analysis-1.0.0.rc11 spec/integration/server_api_spec.rb
openstudio-analysis-1.0.0.rc10 spec/integration/server_api_spec.rb
openstudio-analysis-1.0.0.rc9 spec/integration/server_api_spec.rb
openstudio-analysis-1.0.0.rc8 spec/integration/server_api_spec.rb
openstudio-analysis-1.0.0.rc7 spec/integration/server_api_spec.rb
openstudio-analysis-1.0.0.rc6 spec/integration/server_api_spec.rb
openstudio-analysis-1.0.0.pre.rc5 spec/integration/server_api_spec.rb
openstudio-analysis-1.0.0.pre.rc4 spec/integration/server_api_spec.rb
openstudio-analysis-1.0.0.pre.rc3 spec/integration/server_api_spec.rb
openstudio-analysis-1.0.0.pre.rc2 spec/integration/server_api_spec.rb
openstudio-analysis-1.0.0.pat2 spec/integration/server_api_spec.rb
openstudio-analysis-1.0.0.pat1 spec/integration/server_api_spec.rb