This repository has been archived by the owner on May 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from bdunne/mock_api_for_testing
Add MockApi for testing
- Loading branch information
Showing
27 changed files
with
1,282 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
describe AnsibleTowerClient::JobEvent do | ||
let(:url) { "example.com/api/v1/job_events" } | ||
let(:api) { AnsibleTowerClient::Api.new(instance_double("Faraday::Connection")) } | ||
let(:collection) { api.job_events } | ||
let(:raw_url_collection) { build(:response_url_collection, :klass => described_class, :url => url) } | ||
let(:raw_instance) { build(:response_instance, :job_event, :klass => described_class) } | ||
let(:url) { "example.com/api/v1/job_events" } | ||
let(:api) { AnsibleTowerClient::Api.new(AnsibleTowerClient::MockApi.new) } | ||
|
||
include_examples "Api Methods" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,16 @@ | ||
describe AnsibleTowerClient::Organization do | ||
let(:url) { "example.com/api/v1/organizations/13" } | ||
let(:api) { AnsibleTowerClient::Api.new(instance_double("Faraday::Connection")) } | ||
let(:collection) { api.organizations } | ||
let(:raw_collection) { build(:response_collection, :klass => described_class) } | ||
let(:raw_url_collection) { build(:response_url_collection, :klass => described_class, :url => url) } | ||
let(:raw_instance) { build(:response_instance, :organization, :klass => described_class, :description => "The Organization", :name => "MyOrg") } | ||
let(:api) { AnsibleTowerClient::Api.new(AnsibleTowerClient::MockApi.new) } | ||
let(:raw_instance) { build(:response_instance, :organization, :klass => described_class, :description => "The Organization", :name => "MyOrg") } | ||
|
||
include_examples "Crud Methods" | ||
|
||
it "#initialize instantiates an #{described_class} from a hash" do | ||
obj = described_class.new(instance_double("AnsibleTowerClient::Api"), raw_instance) | ||
obj = api.organizations.all.first | ||
|
||
expect(obj).to be_a described_class | ||
expect(obj.id).to be_a Integer | ||
expect(obj.url).to be_a String | ||
expect(obj.description).to eq "The Organization" | ||
expect(obj.name).to be_a String | ||
expect(obj).to be_a described_class | ||
expect(obj.id).to be_a Integer | ||
expect(obj.url).to be_a String | ||
expect(obj.description).to eq "The Organization" | ||
expect(obj.name).to be_a String | ||
end | ||
end |
Oops, something went wrong.