static 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/static +11 -0
- data/lib/static/cli.rb +2 -2
- data/lib/static/version.rb +1 -1
- data/vendor/cfoundry-0.5.2/LICENSE +746 -0
- data/vendor/cfoundry-0.5.2/Rakefile +38 -0
- data/vendor/cfoundry-0.5.2/lib/cc_api_stub/applications.rb +53 -0
- data/vendor/cfoundry-0.5.2/lib/cc_api_stub/domains.rb +16 -0
- data/vendor/cfoundry-0.5.2/lib/cc_api_stub/frameworks.rb +22 -0
- data/vendor/cfoundry-0.5.2/lib/cc_api_stub/helper.rb +131 -0
- data/vendor/cfoundry-0.5.2/lib/cc_api_stub/login.rb +21 -0
- data/vendor/cfoundry-0.5.2/lib/cc_api_stub/organization_users.rb +21 -0
- data/vendor/cfoundry-0.5.2/lib/cc_api_stub/organizations.rb +70 -0
- data/vendor/cfoundry-0.5.2/lib/cc_api_stub/routes.rb +26 -0
- data/vendor/cfoundry-0.5.2/lib/cc_api_stub/runtimes.rb +22 -0
- data/vendor/cfoundry-0.5.2/lib/cc_api_stub/service_bindings.rb +22 -0
- data/vendor/cfoundry-0.5.2/lib/cc_api_stub/service_instances.rb +22 -0
- data/vendor/cfoundry-0.5.2/lib/cc_api_stub/services.rb +25 -0
- data/vendor/cfoundry-0.5.2/lib/cc_api_stub/spaces.rb +49 -0
- data/vendor/cfoundry-0.5.2/lib/cc_api_stub/users.rb +84 -0
- data/vendor/cfoundry-0.5.2/lib/cc_api_stub.rb +17 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/auth_token.rb +63 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/baseclient.rb +201 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/chatty_hash.rb +46 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/client.rb +46 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/concerns/login_helpers.rb +13 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/errors.rb +160 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/rest_client.rb +299 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/test_support.rb +3 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/trace_helpers.rb +40 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/uaaclient.rb +112 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/upload_helpers.rb +186 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v1/app.rb +363 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v1/base.rb +71 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v1/client.rb +193 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v1/framework.rb +21 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v1/model.rb +178 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v1/model_magic.rb +129 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v1/runtime.rb +24 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v1/service.rb +39 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v1/service_instance.rb +32 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v1/service_plan.rb +19 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v1/user.rb +22 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v2/app.rb +392 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v2/base.rb +83 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v2/client.rb +138 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v2/domain.rb +11 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v2/framework.rb +14 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v2/model.rb +148 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v2/model_magic.rb +449 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v2/organization.rb +16 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v2/route.rb +15 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v2/runtime.rb +12 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v2/service.rb +19 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v2/service_auth_token.rb +9 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v2/service_binding.rb +10 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v2/service_instance.rb +14 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v2/service_plan.rb +12 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v2/space.rb +18 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/v2/user.rb +64 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/validator.rb +39 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/version.rb +4 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry/zip.rb +56 -0
- data/vendor/cfoundry-0.5.2/lib/cfoundry.rb +2 -0
- data/vendor/cfoundry-0.5.2/spec/cc_api_stub/applications_spec.rb +69 -0
- data/vendor/cfoundry-0.5.2/spec/cc_api_stub/domains_spec.rb +19 -0
- data/vendor/cfoundry-0.5.2/spec/cc_api_stub/frameworks_spec.rb +19 -0
- data/vendor/cfoundry-0.5.2/spec/cc_api_stub/login_spec.rb +20 -0
- data/vendor/cfoundry-0.5.2/spec/cc_api_stub/organization_users_spec.rb +19 -0
- data/vendor/cfoundry-0.5.2/spec/cc_api_stub/organizations_spec.rb +97 -0
- data/vendor/cfoundry-0.5.2/spec/cc_api_stub/routes_spec.rb +19 -0
- data/vendor/cfoundry-0.5.2/spec/cc_api_stub/runtimes_spec.rb +19 -0
- data/vendor/cfoundry-0.5.2/spec/cc_api_stub/service_bindings_spec.rb +13 -0
- data/vendor/cfoundry-0.5.2/spec/cc_api_stub/service_instances_spec.rb +19 -0
- data/vendor/cfoundry-0.5.2/spec/cc_api_stub/services_spec.rb +12 -0
- data/vendor/cfoundry-0.5.2/spec/cc_api_stub/spaces_spec.rb +38 -0
- data/vendor/cfoundry-0.5.2/spec/cc_api_stub/users_spec.rb +107 -0
- data/vendor/cfoundry-0.5.2/spec/cfoundry/auth_token_spec.rb +125 -0
- data/vendor/cfoundry-0.5.2/spec/cfoundry/baseclient_spec.rb +225 -0
- data/vendor/cfoundry-0.5.2/spec/cfoundry/client_spec.rb +15 -0
- data/vendor/cfoundry-0.5.2/spec/cfoundry/errors_spec.rb +80 -0
- data/vendor/cfoundry-0.5.2/spec/cfoundry/rest_client_spec.rb +281 -0
- data/vendor/cfoundry-0.5.2/spec/cfoundry/trace_helpers_spec.rb +72 -0
- data/vendor/cfoundry-0.5.2/spec/cfoundry/uaaclient_spec.rb +332 -0
- data/vendor/cfoundry-0.5.2/spec/cfoundry/upload_helpers_spec.rb +174 -0
- data/vendor/cfoundry-0.5.2/spec/cfoundry/v1/base_spec.rb +58 -0
- data/vendor/cfoundry-0.5.2/spec/cfoundry/v1/client_spec.rb +17 -0
- data/vendor/cfoundry-0.5.2/spec/cfoundry/v1/model_magic_spec.rb +43 -0
- data/vendor/cfoundry-0.5.2/spec/cfoundry/v2/app_spec.rb +144 -0
- data/vendor/cfoundry-0.5.2/spec/cfoundry/v2/base_spec.rb +299 -0
- data/vendor/cfoundry-0.5.2/spec/cfoundry/v2/client_spec.rb +73 -0
- data/vendor/cfoundry-0.5.2/spec/cfoundry/v2/model_magic_spec.rb +173 -0
- data/vendor/cfoundry-0.5.2/spec/cfoundry/v2/organization_spec.rb +15 -0
- data/vendor/cfoundry-0.5.2/spec/cfoundry/v2/space_spec.rb +15 -0
- data/vendor/cfoundry-0.5.2/spec/fakes/app_fake.rb +5 -0
- data/vendor/cfoundry-0.5.2/spec/fakes/domain_fake.rb +5 -0
- data/vendor/cfoundry-0.5.2/spec/fakes/framework_fake.rb +5 -0
- data/vendor/cfoundry-0.5.2/spec/fakes/organization_fake.rb +5 -0
- data/vendor/cfoundry-0.5.2/spec/fakes/route_fake.rb +5 -0
- data/vendor/cfoundry-0.5.2/spec/fakes/runtime_fake.rb +5 -0
- data/vendor/cfoundry-0.5.2/spec/fakes/service_fake.rb +5 -0
- data/vendor/cfoundry-0.5.2/spec/fakes/service_instance_fake.rb +5 -0
- data/vendor/cfoundry-0.5.2/spec/fakes/service_plan_fake.rb +5 -0
- data/vendor/cfoundry-0.5.2/spec/fakes/space_fake.rb +5 -0
- data/vendor/cfoundry-0.5.2/spec/fakes/user_fake.rb +5 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/apps/with_dotfiles/xyz +1 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/apps/with_nested_directories/foo/bar/baz/fizz +0 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/apps/with_nested_directories/xyz +0 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/apps/with_vmcignore/ignored_dir/file_in_ignored_dir.txt +1 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/apps/with_vmcignore/ignored_file.txt +1 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/apps/with_vmcignore/non_ignored_dir/file_in_non_ignored_dir.txt +1 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/apps/with_vmcignore/non_ignored_dir/ignored_file.txt +1 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/apps/with_vmcignore/non_ignored_file.txt +1 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/empty_file +0 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_application.json +24 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_application_summary.json +57 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_created_application.json +11 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_created_domain.json +10 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_created_organization.json +11 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_created_route.json +13 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_created_service_instance.json +11 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_created_space.json +11 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_created_user.json +11 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_empty_search.json +7 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_frameworks.json +20 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_organization.json +144 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_organization_domains.json +34 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_organization_search.json +37 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_organization_summary.json +19 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_organization_users.json +81 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_runtimes.json +20 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_service_binding.json +22 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_service_bindings.json +24 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_service_instance.json +81 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_service_instances.json +0 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_service_types.json +124 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_space.json +45 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_space_summary.json +86 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_stats.json +29 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_user.json +112 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_user_organizations.json +92 -0
- data/vendor/cfoundry-0.5.2/spec/fixtures/fake_cc_user_with_managers.json +85 -0
- data/vendor/cfoundry-0.5.2/spec/spec_helper.rb +20 -0
- data/vendor/cfoundry-0.5.2/spec/support/fake_helper.rb +236 -0
- data/vendor/cfoundry-0.5.2/spec/support/randoms.rb +3 -0
- data/vendor/cfoundry-0.5.2/spec/support/shared_examples/cc_api_stub_request_examples.rb +79 -0
- data/vendor/cfoundry-0.5.2/spec/support/shared_examples/client_login_examples.rb +46 -0
- data/vendor/cfoundry-0.5.2/spec/support/shared_examples/model_summary_examples.rb +34 -0
- data/vendor/cfoundry-0.5.2/spec/support/v1_fake_helper.rb +144 -0
- data/vendor/cfoundry-0.5.2/vendor/errors/README.md +4 -0
- data/vendor/cfoundry-0.5.2/vendor/errors/v1.yml +189 -0
- data/vendor/cfoundry-0.5.2/vendor/errors/v2.yml +360 -0
- data/vendor/tunnel-vmc-plugin-0.2.2/Rakefile +39 -0
- data/vendor/tunnel-vmc-plugin-0.2.2/config/clients.yml +17 -0
- data/vendor/tunnel-vmc-plugin-0.2.2/helper-app/Gemfile +10 -0
- data/vendor/tunnel-vmc-plugin-0.2.2/helper-app/server.rb +43 -0
- data/vendor/tunnel-vmc-plugin-0.2.2/lib/tunnel-vmc-plugin/plugin.rb +178 -0
- data/vendor/tunnel-vmc-plugin-0.2.2/lib/tunnel-vmc-plugin/tunnel.rb +308 -0
- data/vendor/tunnel-vmc-plugin-0.2.2/lib/tunnel-vmc-plugin/version.rb +3 -0
- data/vendor/tunnel-vmc-plugin-0.2.2/spec/plugin_spec.rb +29 -0
- data/vendor/tunnel-vmc-plugin-0.2.2/spec/spec_helper.rb +15 -0
- data/vendor/vmc-0.5.0/LICENSE +1277 -0
- data/vendor/vmc-0.5.0/Rakefile +101 -0
- data/vendor/vmc-0.5.0/bin/vmc +11 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/app.rb +45 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/apps.rb +99 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/base.rb +82 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/crashes.rb +42 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/delete.rb +95 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/deprecated.rb +11 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/env.rb +78 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/files.rb +137 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/health.rb +26 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/instances.rb +53 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/logs.rb +76 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/push/create.rb +153 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/push/interactions.rb +94 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/push/sync.rb +64 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/push.rb +105 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/rename.rb +35 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/restart.rb +20 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/scale.rb +71 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/start.rb +150 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/stats.rb +67 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/app/stop.rb +27 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/domain/base.rb +12 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/domain/domains.rb +40 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/domain/map.rb +55 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/domain/unmap.rb +56 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/help.rb +15 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/interactive.rb +105 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/organization/base.rb +14 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/organization/create.rb +32 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/organization/delete.rb +73 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/organization/org.rb +45 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/organization/orgs.rb +35 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/organization/rename.rb +36 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/route/base.rb +12 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/route/map.rb +80 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/route/routes.rb +26 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/route/unmap.rb +94 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/service/base.rb +8 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/service/bind.rb +44 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/service/create.rb +126 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/service/delete.rb +86 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/service/rename.rb +35 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/service/service.rb +42 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/service/services.rb +114 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/service/unbind.rb +38 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/space/base.rb +21 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/space/create.rb +60 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/space/delete.rb +95 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/space/rename.rb +39 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/space/space.rb +64 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/space/spaces.rb +55 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/space/switch.rb +16 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/start/base.rb +83 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/start/colors.rb +13 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/start/info.rb +126 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/start/login.rb +96 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/start/logout.rb +17 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/start/target.rb +71 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/start/target_interactions.rb +37 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/start/targets.rb +16 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/user/base.rb +29 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/user/create.rb +39 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/user/delete.rb +27 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/user/passwd.rb +50 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/user/register.rb +42 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli/user/users.rb +32 -0
- data/vendor/vmc-0.5.0/lib/vmc/cli.rb +475 -0
- data/vendor/vmc-0.5.0/lib/vmc/constants.rb +13 -0
- data/vendor/vmc-0.5.0/lib/vmc/detect.rb +129 -0
- data/vendor/vmc-0.5.0/lib/vmc/errors.rb +17 -0
- data/vendor/vmc-0.5.0/lib/vmc/plugin.rb +56 -0
- data/vendor/vmc-0.5.0/lib/vmc/spacing.rb +89 -0
- data/vendor/vmc-0.5.0/lib/vmc/spec_helper.rb +1 -0
- data/vendor/vmc-0.5.0/lib/vmc/test_support.rb +6 -0
- data/vendor/vmc-0.5.0/lib/vmc/version.rb +3 -0
- data/vendor/vmc-0.5.0/lib/vmc.rb +8 -0
- data/vendor/vmc-0.5.0/spec/assets/hello-sinatra/Gemfile +3 -0
- data/vendor/vmc-0.5.0/spec/assets/hello-sinatra/config.ru +3 -0
- data/vendor/vmc-0.5.0/spec/assets/hello-sinatra/main.rb +6 -0
- data/vendor/vmc-0.5.0/spec/assets/specker_runner/specker_runner_input.rb +6 -0
- data/vendor/vmc-0.5.0/spec/assets/specker_runner/specker_runner_pause.rb +5 -0
- data/vendor/vmc-0.5.0/spec/console_app_specker/console_app_specker_matchers_spec.rb +152 -0
- data/vendor/vmc-0.5.0/spec/console_app_specker/specker_runner_spec.rb +157 -0
- data/vendor/vmc-0.5.0/spec/features/v1/new_user_flow_spec.rb +109 -0
- data/vendor/vmc-0.5.0/spec/features/v2/account_lifecycle_spec.rb +64 -0
- data/vendor/vmc-0.5.0/spec/features/v2/push_flow_spec.rb +125 -0
- data/vendor/vmc-0.5.0/spec/features/v2/switching_targets_spec.rb +32 -0
- data/vendor/vmc-0.5.0/spec/spec_helper.rb +63 -0
- data/vendor/vmc-0.5.0/spec/support/command_helper.rb +80 -0
- data/vendor/vmc-0.5.0/spec/support/config_helper.rb +15 -0
- data/vendor/vmc-0.5.0/spec/support/console_app_specker_matchers.rb +75 -0
- data/vendor/vmc-0.5.0/spec/support/fake_home_dir.rb +55 -0
- data/vendor/vmc-0.5.0/spec/support/interact_helper.rb +29 -0
- data/vendor/vmc-0.5.0/spec/support/shared_examples/errors.rb +40 -0
- data/vendor/vmc-0.5.0/spec/support/shared_examples/input.rb +14 -0
- data/vendor/vmc-0.5.0/spec/support/specker_runner.rb +79 -0
- data/vendor/vmc-0.5.0/spec/support/tracking_expector.rb +71 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/app/base_spec.rb +17 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/app/delete_spec.rb +188 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/app/instances_spec.rb +65 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/app/push/create_spec.rb +591 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/app/push_spec.rb +369 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/app/rename_spec.rb +104 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/app/scale_spec.rb +76 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/app/start_spec.rb +168 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/app/stats_spec.rb +68 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/domain/map_spec.rb +130 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/domain/unmap_spec.rb +69 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/organization/orgs_spec.rb +108 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/organization/rename_spec.rb +113 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/route/map_spec.rb +140 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/route/unmap_spec.rb +221 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/service/bind_spec.rb +25 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/service/delete_spec.rb +22 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/service/rename_spec.rb +105 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/service/service_spec.rb +23 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/service/unbind_spec.rb +25 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/space/create_spec.rb +73 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/space/rename_spec.rb +102 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/space/spaces_spec.rb +104 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/space/switch_space_spec.rb +55 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/start/info_spec.rb +160 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/start/login_spec.rb +142 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/start/logout_spec.rb +50 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/start/target_spec.rb +123 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/user/create_spec.rb +54 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/user/delete_spec.rb +51 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/user/passwd_spec.rb +102 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli/user/register_spec.rb +140 -0
- data/vendor/vmc-0.5.0/spec/vmc/cli_spec.rb +448 -0
- data/vendor/vmc-0.5.0/spec/vmc/detect_spec.rb +54 -0
- metadata +446 -43
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe CFoundry::RestClient do
|
|
4
|
+
let(:token) { nil }
|
|
5
|
+
let(:target) { "https://api.cloudfoundry.com" }
|
|
6
|
+
let(:rest_client) { CFoundry::RestClient.new(target, token) }
|
|
7
|
+
|
|
8
|
+
describe '#request' do
|
|
9
|
+
let(:path) { "some-path" }
|
|
10
|
+
let(:url) { "#{target}/#{path}" }
|
|
11
|
+
let(:method) { "GET" }
|
|
12
|
+
let(:options) { {} }
|
|
13
|
+
|
|
14
|
+
def check_request(method = :get, &block)
|
|
15
|
+
request_stub = stub_request(method, url).to_return do |req|
|
|
16
|
+
block.call(req)
|
|
17
|
+
{}
|
|
18
|
+
end
|
|
19
|
+
subject
|
|
20
|
+
expect(request_stub).to have_been_requested
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
subject { rest_client.request(method, path, options) }
|
|
24
|
+
|
|
25
|
+
describe 'headers' do
|
|
26
|
+
%w[Authorization Proxy-User X-Request-Id Content-Type].each do |header_name|
|
|
27
|
+
it "should not include the #{header_name} by default" do
|
|
28
|
+
check_request do |req|
|
|
29
|
+
expect(req.headers).not_to have_key(header_name)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should not provide specific accept mimetypes by default" do
|
|
35
|
+
check_request do |req|
|
|
36
|
+
expect(req.headers["Accept"]).to eql("*/*")
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it 'should always include a content length' do
|
|
41
|
+
check_request do |req|
|
|
42
|
+
expect(req.headers["Content-Length"]).to eql(0)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
context "when a payload is passed" do
|
|
47
|
+
context "when the payload is a string" do
|
|
48
|
+
let(:options) { { :payload => "some payload"} }
|
|
49
|
+
|
|
50
|
+
it 'includes a content length matching the payload size' do
|
|
51
|
+
check_request do |req|
|
|
52
|
+
expect(req.headers["Content-Length"]).to eql("some payload".length)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
context "when the payload is a hash and the content-type is JSON" do
|
|
58
|
+
let(:options) { { :payload => { "key" => "value" }, :content => :json } }
|
|
59
|
+
|
|
60
|
+
it 'includes a content length matching the JSON encoded length' do
|
|
61
|
+
check_request do |req|
|
|
62
|
+
expect(req.headers["Content-Length"]).to eql('{"key":"value"}'.length)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
context "when the payload is a hash (i.e. multipart upload)" do
|
|
68
|
+
let(:method) { "PUT" }
|
|
69
|
+
let(:options) { { :payload => { "key" => "value" } } }
|
|
70
|
+
|
|
71
|
+
it 'includes a nonzero content length' do
|
|
72
|
+
check_request(:put) do |req|
|
|
73
|
+
expect(req.headers["Content-Length"].to_i).to be > 0
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
context 'and the token is set' do
|
|
80
|
+
let(:token_header) { "bearer something" }
|
|
81
|
+
let(:token) { CFoundry::AuthToken.new(token_header) }
|
|
82
|
+
|
|
83
|
+
it 'should include Authorization in the header' do
|
|
84
|
+
check_request do |req|
|
|
85
|
+
expect(req.headers["Authorization"]).to eq(token_header)
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
context 'and the request_id is set' do
|
|
91
|
+
before { rest_client.request_id = "SomeRequestId" }
|
|
92
|
+
|
|
93
|
+
it 'should include X-Request-Id in the header' do
|
|
94
|
+
check_request do |req|
|
|
95
|
+
expect(req.headers["X-Request-Id"]).to eq "SomeRequestId"
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
context 'and the proxy is set' do
|
|
101
|
+
before { rest_client.instance_variable_set(:@proxy, "some proxy") }
|
|
102
|
+
|
|
103
|
+
it 'should include X-Request-Id in the header' do
|
|
104
|
+
check_request do |req|
|
|
105
|
+
expect(req.headers["Proxy-User"]).to eq "some proxy"
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
context 'and the content is passed in' do
|
|
111
|
+
let(:options) { {:content => "text/xml"} }
|
|
112
|
+
|
|
113
|
+
it 'should include Content-Type in the header' do
|
|
114
|
+
check_request do |req|
|
|
115
|
+
expect(req.headers["Content-Type"]).to eq "text/xml"
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
context 'and custom headers are passed in' do
|
|
121
|
+
let(:options) { {:headers => {"X-Foo" => "Bar"}} }
|
|
122
|
+
|
|
123
|
+
it 'should include the custom header in the header' do
|
|
124
|
+
check_request do |req|
|
|
125
|
+
expect(req.headers["X-Foo"]).to eq "Bar"
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
context 'and it overrides an existing one' do
|
|
130
|
+
let(:options) { { :content => "text/xml", :headers => { "Content-Type" => "text/html" } } }
|
|
131
|
+
|
|
132
|
+
it 'uses the custom header' do
|
|
133
|
+
check_request do |req|
|
|
134
|
+
expect(req.headers["Content-Type"]).to eq "text/html"
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
describe 'payload' do
|
|
142
|
+
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
describe 'errors' do
|
|
146
|
+
context "when the target refuses the connection" do
|
|
147
|
+
let(:target) { "http://localhost:2358974958" }
|
|
148
|
+
|
|
149
|
+
it "raises CFoundry::TargetRefused" do
|
|
150
|
+
stub_request(:get, url).to_raise(Errno::ECONNREFUSED)
|
|
151
|
+
expect { subject }.to raise_error(CFoundry::TargetRefused)
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
context "when the target is not a HTTP(S) URI" do
|
|
156
|
+
let(:target) { "ftp://foo-bar.com" }
|
|
157
|
+
|
|
158
|
+
it "raises CFoundry::InvalidTarget" do
|
|
159
|
+
expect { subject }.to raise_error(CFoundry::InvalidTarget)
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
context "when the target URI is invalid" do
|
|
164
|
+
let(:target) { "@#*#^! rubby" }
|
|
165
|
+
|
|
166
|
+
it "raises CFoundry::InvalidTarget" do
|
|
167
|
+
expect { subject }.to raise_error(CFoundry::InvalidTarget)
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
describe "the return value" do
|
|
173
|
+
before do
|
|
174
|
+
stub_request(:get, url).to_return({
|
|
175
|
+
:status => 201,
|
|
176
|
+
:headers => { "Content-Type" => "application/json"},
|
|
177
|
+
:body => '{ "foo": 1 }'
|
|
178
|
+
})
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
it "returns a request hash and a response hash" do
|
|
182
|
+
expect(subject).to be_an(Array)
|
|
183
|
+
expect(subject.length).to eq(2)
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
describe "the returned request hash" do
|
|
187
|
+
it "returns a hash of :headers, :url, :body and :method" do
|
|
188
|
+
expect(subject[0]).to eq({
|
|
189
|
+
:url => url,
|
|
190
|
+
:method => "GET",
|
|
191
|
+
:headers => { "Content-Length" => 0 },
|
|
192
|
+
:body => nil
|
|
193
|
+
})
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
describe "the returned response hash" do
|
|
198
|
+
it "returns a hash of :headers, :status, :body" do
|
|
199
|
+
expect(subject[1]).to eq({
|
|
200
|
+
:status => "201",
|
|
201
|
+
:headers => { "content-type" => "application/json"},
|
|
202
|
+
:body => '{ "foo": 1 }'
|
|
203
|
+
})
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
describe "when the path starts with a slash" do
|
|
209
|
+
let(:path) { "/some-path/some-segment" }
|
|
210
|
+
|
|
211
|
+
it "doesn't add a double slash" do
|
|
212
|
+
stub = stub_request(:get, "https://api.cloudfoundry.com/some-path/some-segment")
|
|
213
|
+
subject
|
|
214
|
+
expect(stub).to have_been_requested
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
describe "when the path does not start with a slash" do
|
|
219
|
+
let(:path) { "some-path/some-segment" }
|
|
220
|
+
|
|
221
|
+
it "doesn't add a double slash" do
|
|
222
|
+
stub = stub_request(:get, "https://api.cloudfoundry.com/some-path/some-segment")
|
|
223
|
+
subject
|
|
224
|
+
expect(stub).to have_been_requested
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
describe "when the path is a full url" do
|
|
229
|
+
let(:path) { "http://example.com" }
|
|
230
|
+
|
|
231
|
+
it "requests the given url" do
|
|
232
|
+
stub = stub_request(:get, "http://example.com")
|
|
233
|
+
subject
|
|
234
|
+
expect(stub).to have_been_requested
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
describe "when the path is malformed" do
|
|
239
|
+
let(:path) { "#%&*$(#%&$%)" }
|
|
240
|
+
|
|
241
|
+
it "blows up" do
|
|
242
|
+
expect { subject }.to raise_error(URI::InvalidURIError)
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
describe 'trace' do
|
|
247
|
+
before do
|
|
248
|
+
rest_client.trace = true
|
|
249
|
+
stub_request(:get, url).to_return(:status => 200, :headers => { "content-type" => "application/json" }, :body => '{"some": "json"}')
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
it "prints the request and the response" do
|
|
253
|
+
mock(rest_client).print_request({:headers=>{"Content-Length"=>0}, :url=>"https://api.cloudfoundry.com/some-path", :method=>"GET", :body=>nil})
|
|
254
|
+
mock(rest_client).print_response({ :status => "200", :headers => { "content-type" => "application/json" }, :body => '{"some": "json"}' })
|
|
255
|
+
subject
|
|
256
|
+
end
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
describe "following redirects" do
|
|
260
|
+
before do
|
|
261
|
+
stub_request(:post, "https://api.cloudfoundry.com/apps").to_return(
|
|
262
|
+
:status => 301,
|
|
263
|
+
:headers => { "location" => "https://api.cloudfoundry.com/apps/some-guid" }
|
|
264
|
+
)
|
|
265
|
+
stub_request(:get, "https://api.cloudfoundry.com/apps/some-guid").to_return(
|
|
266
|
+
:status => 200,
|
|
267
|
+
:body => '{"some": "json"}'
|
|
268
|
+
)
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
it "follows redirects correctly, returning the response to the 2nd redirect" do
|
|
272
|
+
request, response = rest_client.request("POST", "apps")
|
|
273
|
+
expect(response).to eql(
|
|
274
|
+
:status => "200",
|
|
275
|
+
:headers => {},
|
|
276
|
+
:body => '{"some": "json"}'
|
|
277
|
+
)
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe CFoundry::TraceHelpers do
|
|
4
|
+
let(:fake_class) { Class.new { include CFoundry::TraceHelpers } }
|
|
5
|
+
let(:request) do
|
|
6
|
+
{
|
|
7
|
+
:method => "GET",
|
|
8
|
+
:url => "http://api.cloudfoundry.com/foo",
|
|
9
|
+
:headers => { "bb-foo" => "bar", "accept" => "*/*" }
|
|
10
|
+
}
|
|
11
|
+
end
|
|
12
|
+
let(:response) { { :status => 404, :body => "not found", :headers => {} } }
|
|
13
|
+
|
|
14
|
+
shared_examples "request_trace tests" do
|
|
15
|
+
it { should include request_trace }
|
|
16
|
+
it { should include header_trace }
|
|
17
|
+
it { should include body_trace }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
shared_examples "response_trace tests" do
|
|
21
|
+
before { response[:body] = response_body }
|
|
22
|
+
|
|
23
|
+
it "traces the provided response" do
|
|
24
|
+
fake_class.new.response_trace(response).should == response_trace
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
describe "#request_trace" do
|
|
29
|
+
let(:request_trace) { "REQUEST: GET http://api.cloudfoundry.com/foo" }
|
|
30
|
+
let(:header_trace) { "REQUEST_HEADERS:\n accept : */*\n bb-foo : bar" }
|
|
31
|
+
let(:body_trace) { "" }
|
|
32
|
+
|
|
33
|
+
subject { fake_class.new.request_trace(request) }
|
|
34
|
+
|
|
35
|
+
context "without a request body" do
|
|
36
|
+
include_examples "request_trace tests"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
context "with a request body" do
|
|
40
|
+
let(:body_trace) { "REQUEST_BODY: Some body text" }
|
|
41
|
+
|
|
42
|
+
before { request[:body] = "Some body text" }
|
|
43
|
+
|
|
44
|
+
include_examples "request_trace tests"
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it "returns nil if request is nil" do
|
|
48
|
+
fake_class.new.request_trace(nil).should == nil
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
describe "#response_trace" do
|
|
54
|
+
context "with a non-JSON response body" do
|
|
55
|
+
let(:response_trace) { "RESPONSE: [404]\nRESPONSE_HEADERS:\n\nRESPONSE_BODY:\nSome body" }
|
|
56
|
+
let(:response_body) { "Some body"}
|
|
57
|
+
|
|
58
|
+
include_examples "response_trace tests"
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
context "with a JSON response body" do
|
|
62
|
+
let(:response_body) { "{\"name\": \"vcap\",\"build\": 2222,\"support\": \"http://support.cloudfoundry.com\"}" }
|
|
63
|
+
let(:response_trace) { "RESPONSE: [404]\nRESPONSE_HEADERS:\n\nRESPONSE_BODY:\n#{MultiJson.dump(MultiJson.load(response_body), :pretty => true)}" }
|
|
64
|
+
|
|
65
|
+
include_examples "response_trace tests"
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it "returns nil if response is nil" do
|
|
69
|
+
fake_class.new.response_trace(nil).should == nil
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe CFoundry::UAAClient do
|
|
4
|
+
let(:target) { "https://uaa.example.com" }
|
|
5
|
+
let(:uaa) { CFoundry::UAAClient.new(target) }
|
|
6
|
+
let(:auth_header) { "bearer access-token" }
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
uaa.token = CFoundry::AuthToken.new(auth_header)
|
|
10
|
+
CF::UAA::Util.default_logger.level = 1
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
shared_examples "UAA wrapper" do
|
|
14
|
+
it "converts UAA errors to CFoundry equivalents" do
|
|
15
|
+
mock(uaa).wrap_uaa_errors { nil }
|
|
16
|
+
subject
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe '#prompts' do
|
|
21
|
+
subject { uaa.prompts }
|
|
22
|
+
|
|
23
|
+
include_examples "UAA wrapper"
|
|
24
|
+
|
|
25
|
+
# GET (target)/login
|
|
26
|
+
it "receives the prompts from /login" do
|
|
27
|
+
stub_request(:get, "#{target}/login").to_return :status => 200,
|
|
28
|
+
:headers => {'Content-Type' => 'application/json'},
|
|
29
|
+
:body => <<EOF
|
|
30
|
+
{
|
|
31
|
+
"timestamp": "2012-11-08T13:32:18+0000",
|
|
32
|
+
"commit_id": "ebbf817",
|
|
33
|
+
"app": {
|
|
34
|
+
"version": "1.2.6",
|
|
35
|
+
"artifact": "cloudfoundry-identity-uaa",
|
|
36
|
+
"description": "User Account and Authentication Service",
|
|
37
|
+
"name": "UAA"
|
|
38
|
+
},
|
|
39
|
+
"prompts": {
|
|
40
|
+
"username": [
|
|
41
|
+
"text",
|
|
42
|
+
"Email"
|
|
43
|
+
],
|
|
44
|
+
"password": [
|
|
45
|
+
"password",
|
|
46
|
+
"Password"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
EOF
|
|
51
|
+
|
|
52
|
+
expect(subject).to eq(
|
|
53
|
+
:username => ["text", "Email"],
|
|
54
|
+
:password => ["password", "Password"])
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
describe '#authorize' do
|
|
59
|
+
let(:username) { "foo@bar.com" }
|
|
60
|
+
let(:password) { "test" }
|
|
61
|
+
let(:creds) { {:username => username, :password => password} }
|
|
62
|
+
let(:state) { 'somestate' }
|
|
63
|
+
let(:redirect_uri) { 'https://uaa.cloudfoundry.com/redirect/vmc' }
|
|
64
|
+
let(:auth) { Object.new }
|
|
65
|
+
let(:issuer) { Object.new }
|
|
66
|
+
|
|
67
|
+
subject { uaa.authorize(username, password) }
|
|
68
|
+
|
|
69
|
+
before do
|
|
70
|
+
stub(issuer).owner_password_grant { auth }
|
|
71
|
+
stub(uaa).token_issuer { issuer }
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
include_examples "UAA wrapper"
|
|
75
|
+
|
|
76
|
+
it 'returns the token on successful authentication' do
|
|
77
|
+
mock(issuer).owner_password_grant(username, password) { auth }
|
|
78
|
+
expect(subject).to eq auth
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
context 'when authorization fails' do
|
|
82
|
+
context 'in the expected way' do
|
|
83
|
+
it 'raises a CFoundry::Denied error' do
|
|
84
|
+
mock(issuer).owner_password_grant(anything, anything) { raise CF::UAA::BadResponse.new("401: FooBar") }
|
|
85
|
+
expect { subject }.to raise_error(CFoundry::Denied, "401: Authorization failed")
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
context 'in an unexpected way' do
|
|
90
|
+
it 'raises a CFoundry::Denied error' do
|
|
91
|
+
mock(issuer).owner_password_grant(anything, anything) { raise CF::UAA::BadResponse.new("no_status_code") }
|
|
92
|
+
expect { subject }.to raise_error(CFoundry::Denied, "400: Authorization failed")
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
context "with a CF::UAA::TargetError" do
|
|
97
|
+
it "retries with implicit grant" do
|
|
98
|
+
stub(issuer).owner_password_grant { raise CF::UAA::TargetError.new("useless info") }
|
|
99
|
+
mock(issuer).implicit_grant_with_creds(:username => username, :password => password)
|
|
100
|
+
expect { subject }.to_not raise_error
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
describe '#users' do
|
|
107
|
+
subject { uaa.users }
|
|
108
|
+
|
|
109
|
+
it 'requests /Users' do
|
|
110
|
+
stub_request(:get, "#{target}/Users").with(
|
|
111
|
+
:headers => { "authorization" => auth_header }
|
|
112
|
+
).to_return(
|
|
113
|
+
:headers => {'Content-Type' => 'application/json'},
|
|
114
|
+
:body => '{ "resources": [] }'
|
|
115
|
+
)
|
|
116
|
+
expect(subject).to eq({'resources' => []})
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
context "when there is no token" do
|
|
120
|
+
before { uaa.token = nil }
|
|
121
|
+
|
|
122
|
+
it "doesn't blow up" do
|
|
123
|
+
stub_request(:get, "#{target}/Users").to_return(
|
|
124
|
+
:headers => {'Content-Type' => 'application/json'},
|
|
125
|
+
:body => '{ "resources": [] }'
|
|
126
|
+
)
|
|
127
|
+
expect(subject).to eq({'resources' => []})
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
describe '#change_password' do
|
|
133
|
+
let(:guid) { "foo-bar-baz" }
|
|
134
|
+
let(:old) { "old-pass" }
|
|
135
|
+
let(:new) { "new-pass" }
|
|
136
|
+
|
|
137
|
+
subject { uaa.change_password(guid, new, old) }
|
|
138
|
+
|
|
139
|
+
include_examples "UAA wrapper"
|
|
140
|
+
|
|
141
|
+
it 'sends a password change request' do
|
|
142
|
+
req = stub_request(:put, "#{target}/Users/#{guid}/password").with(
|
|
143
|
+
:headers => {
|
|
144
|
+
"Content-Type" => "application/json;charset=utf-8",
|
|
145
|
+
"Accept" => "application/json;charset=utf-8",
|
|
146
|
+
"Authorization" => auth_header
|
|
147
|
+
}
|
|
148
|
+
).to_return(
|
|
149
|
+
:status => 200,
|
|
150
|
+
:headers => {'Content-Type' => 'application/json'},
|
|
151
|
+
:body => '{ "status": "ok", "message": "password_updated" }'
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
subject
|
|
155
|
+
|
|
156
|
+
expect(req).to have_been_requested
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
describe '#password_score' do
|
|
161
|
+
let(:password) { "password" }
|
|
162
|
+
let(:response) { MultiJson.encode({}) }
|
|
163
|
+
|
|
164
|
+
subject { uaa.password_score(password) }
|
|
165
|
+
|
|
166
|
+
include_examples "UAA wrapper"
|
|
167
|
+
|
|
168
|
+
before do
|
|
169
|
+
stub_request(:post, "#{target}/password/score").with(
|
|
170
|
+
:body => 'password=password',
|
|
171
|
+
:headers => {
|
|
172
|
+
'Accept' => 'application/json;charset=utf-8',
|
|
173
|
+
'Content-Type' => 'application/x-www-form-urlencoded;charset=utf-8',
|
|
174
|
+
}
|
|
175
|
+
).to_return(
|
|
176
|
+
:status => 200,
|
|
177
|
+
:headers => {'Content-Type' => 'application/json'},
|
|
178
|
+
:body => response
|
|
179
|
+
)
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
context 'when the score is 0 and the required is 0' do
|
|
183
|
+
let(:response) { MultiJson.encode "score" => 0, "requiredScore" => 0 }
|
|
184
|
+
it { should == :good }
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
context 'when the score is less than the required score' do
|
|
188
|
+
let(:response) { MultiJson.encode "score" => 1, "requiredScore" => 5 }
|
|
189
|
+
it { should == :weak }
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
context 'and the score is equal to the required score' do
|
|
193
|
+
let(:response) { MultiJson.encode "score" => 5, "requiredScore" => 5 }
|
|
194
|
+
it { should == :good }
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
context 'and the score is greater than the required score' do
|
|
198
|
+
let(:response) { MultiJson.encode "score" => 6, "requiredScore" => 5 }
|
|
199
|
+
it { should == :good }
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
context 'and the score is 10' do
|
|
203
|
+
let(:response) { MultiJson.encode "score" => 10, "requiredScore" => 5 }
|
|
204
|
+
it { should == :strong }
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
context 'and the score is 10' do
|
|
208
|
+
let(:response) { MultiJson.encode "score" => 10, "requiredScore" => 10 }
|
|
209
|
+
it { should == :strong }
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
context 'and the score is invalid' do
|
|
213
|
+
let(:response) { MultiJson.encode "score" => 11, "requiredScore" => 5 }
|
|
214
|
+
it { should == :weak }
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
describe "#add_user" do
|
|
219
|
+
let(:email) { 'test@test.com' }
|
|
220
|
+
let(:password) { 'secret' }
|
|
221
|
+
|
|
222
|
+
subject { uaa.add_user(email, password) }
|
|
223
|
+
|
|
224
|
+
context 'with valid data' do
|
|
225
|
+
it "should add a user" do
|
|
226
|
+
req =
|
|
227
|
+
stub_request(:post, "https://uaa.example.com/Users").with(
|
|
228
|
+
:body =>
|
|
229
|
+
{ :userName => email,
|
|
230
|
+
:emails => [{ :value => email }],
|
|
231
|
+
:password => password,
|
|
232
|
+
:name => { :givenName => email, :familyName => email }
|
|
233
|
+
}
|
|
234
|
+
).to_return(
|
|
235
|
+
:status => 200,
|
|
236
|
+
:body => '{ "id" : "id" }',
|
|
237
|
+
:headers => { "Content-Type" => 'application/json' }
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
expect(subject).to eq({"id" => "id"})
|
|
241
|
+
expect(req).to have_been_requested
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
describe "#wrap_uaa_errors" do
|
|
247
|
+
subject { uaa.send(:wrap_uaa_errors) { raise error } }
|
|
248
|
+
|
|
249
|
+
context "when the block raises CF::UAA::BadResponse" do
|
|
250
|
+
let(:error) { CF::UAA::BadResponse }
|
|
251
|
+
|
|
252
|
+
it "raises CFoundry::BadResponse" do
|
|
253
|
+
expect { subject }.to raise_exception(CFoundry::BadResponse)
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
context "when the block raises CF::UAA::NotFound" do
|
|
258
|
+
let(:error) { CF::UAA::NotFound }
|
|
259
|
+
|
|
260
|
+
it "raises CFoundry::NotFound" do
|
|
261
|
+
expect { subject }.to raise_exception(CFoundry::NotFound)
|
|
262
|
+
end
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
context "when the block raises CF::UAA::InvalidToken" do
|
|
266
|
+
let(:error) { CF::UAA::InvalidToken }
|
|
267
|
+
|
|
268
|
+
it "raises CFoundry::Denied" do
|
|
269
|
+
expect { subject }.to raise_exception(CFoundry::Denied)
|
|
270
|
+
end
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
context "when the block raises CF::UAA::TargetError" do
|
|
274
|
+
let(:error) { CF::UAA::TargetError.new({ :error => "foo", :error_description => "bar" }) }
|
|
275
|
+
|
|
276
|
+
it "raises CFoundry::UAAError" do
|
|
277
|
+
expect { subject }.to raise_exception(CFoundry::UAAError, "foo: bar")
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
describe "#token_issuer" do
|
|
283
|
+
it "has logging level 0 if #trace is true" do
|
|
284
|
+
uaa.trace = true
|
|
285
|
+
expect(uaa.send(:token_issuer).logger.level).to eq -1
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
it "has logging level 1 if #trace is false" do
|
|
289
|
+
uaa.trace = false
|
|
290
|
+
expect(uaa.send(:token_issuer).logger.level).to eq 1
|
|
291
|
+
end
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
describe "#scim" do
|
|
295
|
+
it "has logging level 0 if #trace is true" do
|
|
296
|
+
uaa.trace = true
|
|
297
|
+
expect(uaa.send(:scim).logger.level).to eq -1
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
it "has logging level 1 if #trace is false" do
|
|
301
|
+
uaa.trace = false
|
|
302
|
+
expect(uaa.send(:scim).logger.level).to eq 1
|
|
303
|
+
end
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
describe "#try_to_refresh_token!" do
|
|
307
|
+
it "uses the refresh token to get a new access token" do
|
|
308
|
+
mock(uaa.send(:token_issuer)).refresh_token_grant(uaa.token.refresh_token) do
|
|
309
|
+
CF::UAA::TokenInfo.new(
|
|
310
|
+
:token_type => "bearer",
|
|
311
|
+
:access_token => "refreshed-token",
|
|
312
|
+
:refresh_token => "some-refresh-token")
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
uaa.try_to_refresh_token!
|
|
316
|
+
expect(uaa.token.auth_header).to eq "bearer refreshed-token"
|
|
317
|
+
expect(uaa.token.refresh_token).to eq "some-refresh-token"
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
context "when the refresh token has expired" do
|
|
321
|
+
it "returns the current token" do
|
|
322
|
+
stub(uaa.send(:token_issuer)).refresh_token_grant do
|
|
323
|
+
raise CF::UAA::TargetError.new
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
expect {
|
|
327
|
+
uaa.try_to_refresh_token!
|
|
328
|
+
}.to_not change { uaa.token }
|
|
329
|
+
end
|
|
330
|
+
end
|
|
331
|
+
end
|
|
332
|
+
end
|