Skip to content

Commit

Permalink
Merge pull request #60 from evkhramkov/bug/escape-group-name
Browse files Browse the repository at this point in the history
Escape group names
  • Loading branch information
evkhramkov authored Apr 12, 2019
2 parents d27bccd + e0c7762 commit 1559535
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
18 changes: 18 additions & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,24 @@ lane :test_release_notes do
)
end

lane :test_group_names do
appcenter_upload(
api_token: ENV["TEST_APPCENTER_API_TOKEN"],
owner_name: ENV["TEST_APPCENTER_OWNER_NAME"],
app_name: "MyApplication",
apk: "./fastlane/app-release.apk",
group: "Group%20with%20space"
)

appcenter_upload(
api_token: ENV["TEST_APPCENTER_API_TOKEN"],
owner_name: ENV["TEST_APPCENTER_OWNER_NAME"],
app_name: "MyApplication",
apk: "./fastlane/app-release.apk",
group: "Group with space"
)
end

lane :test do
# appcenter_upload will read release_notes from FL_CHANGELOG
Actions.lane_context[SharedValues::FL_CHANGELOG] = 'shared changelog'
Expand Down
2 changes: 1 addition & 1 deletion lib/fastlane/plugin/appcenter/helper/appcenter_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def self.get_group(api_token, owner_name, app_name, group_name)
connection = self.connection

response = connection.get do |req|
req.url("/v0.1/apps/#{owner_name}/#{app_name}/distribution_groups/#{group_name}")
req.url("/v0.1/apps/#{owner_name}/#{app_name}/distribution_groups/#{ERB::Util.url_encode(group_name)}")
req.headers['X-API-Token'] = api_token
req.headers['internal-request-source'] = "fastlane"
end
Expand Down
30 changes: 29 additions & 1 deletion spec/appcenter_upload_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,6 @@ def stub_add_to_group(status, mandatory_update = false, notify_testers = false)
end").runner.execute(:test)
end


it "uses proper api for mandatory release with email notification parameter" do
stub_check_app(200)
stub_create_release_upload(200)
Expand Down Expand Up @@ -578,6 +577,35 @@ def stub_add_to_group(status, mandatory_update = false, notify_testers = false)
end").runner.execute(:test)
end

it "encodes group names" do
stub_check_app(200)
stub_create_release_upload(200)
stub_upload_build(200)
stub_update_release_upload(200, 'committed')
stub_update_release(200)
stub_get_group(200, 'Testers%201')
stub_get_group(200, 'Testers%202')
stub_get_group(200, 'Testers%203')
stub_add_to_group(200)
stub_add_to_group(200)
stub_add_to_group(200)
stub_get_release(200)
stub_create_dsym_upload(200)
stub_upload_dsym(200)
stub_update_dsym_upload(200, "committed")

Fastlane::FastFile.new.parse("lane :test do
appcenter_upload({
api_token: 'xxx',
owner_name: 'owner',
app_name: 'app',
ipa: './spec/fixtures/appfiles/ipa_file_empty.ipa',
dsym: './spec/fixtures/symbols/Themoji.dSYM.zip',
group: 'Testers 1,Testers 2,Testers 3'
})
end").runner.execute(:test)
end

it "creates app if it was not found" do
stub_check_app(404)
stub_create_app(200)
Expand Down

0 comments on commit 1559535

Please sign in to comment.