Skip to content

Instantly share code, notes, and snippets.

@zjhuntin
Created April 13, 2016 12:32
Show Gist options
  • Save zjhuntin/a364b82aabbe3ec4bf838f3ebba384df to your computer and use it in GitHub Desktop.
Save zjhuntin/a364b82aabbe3ec4bf838f3ebba384df to your computer and use it in GitHub Desktop.
equire File.join(File.dirname(__FILE__), '../test_helper')
require File.join(File.dirname(__FILE__), '../lifecycle_environment/lifecycle_environment_helpers')
describe 'listing activation keys' do
include LifecycleEnvironmentHelpers
before do
@cmd = %w(activation-key list)
end
it "lists an organizations activation keys" do
params = ['--organization-id=1']
ex = api_expects(:activation_keys, :index, 'Organization Activation-key list') do |par|
par['organization_id'] ==1 && par['page'] == 1 &&
par['per_page'] ==1000
end
ex.returns({
"total" => 0,
"subtotal" => 0,
"page" => "1",
"per_page" => "1000",
"error" => nil,
"search" => nil,
"sort" => {
"by" => nil,
"order" => nil
},
"results" => []
})
expected_result = success_result("---|------|------------|-----------------------|-------------
ID | NAME | HOST LIMIT | LIFECYCLE ENVIRONMENT | CONTENT VIEW
---|------|------------|-----------------------|-------------
")
result = run_cmd(@cmd + params)
assert_cmd(expected_result, result)
end
it "lists the activation-keys belonging to a lifecycle environment by name" do
params = ['--organization-id=1', '--environment=test']
expect_lifecycle_environment_search(1, 'test', 1)
ex = api_expects(:activation_keys, :index, 'lifecycle activation-key list') do |par|
par['organization_id'] == 1 && par['page'] == 1 &&
par['per_page'] == 1000 && par['lifecycle_environment_id'] == 2
end
ex.returns({
"total" => 0,
"subtotal" => 0,
"page" => "1",
"per_page" => "1000",
"error" => nil,
"search" => nil,
"sort" => {
"by" => nil,
"order" => nil
},
"results" => []
})
expected_result = success_result("---|------|------------|-----------------------|-------------
ID | NAME | HOST LIMIT | LIFECYCLE ENVIRONMENT | CONTENT VIEW
---|------|------------|-----------------------|-------------
")
result = run_cmd(@cmd + params)
assert_cmd(expected_result, result)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment