-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add AsanaUploadAction #2
Conversation
url = Helper::DdgAppleAutomationHelper::ASANA_API_URL + "/tasks/#{task_id}/attachments" | ||
response = HTTParty.post(url, | ||
headers: { 'Authorization' => "Bearer #{token}" }, | ||
body: { file: file }) | ||
|
||
unless response.success? | ||
UI.user_error!("Failed to upload file to Asana task: (#{response.code} #{response.message})") | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since UI.user_error!
doesn't cause a test to stop (while it causes fastlane to stop the action/lane), it's tricky to test UI.user_error!
stopping execution. I would suggest that we include all this code under begin/rescue clause, so that UI.user_error!
calls are always the last thing to happen within #run
function.
This may not scale as the complexity of our action raises and we may need to either find a different solution or stop testing user_error that thoroughly :/
unless response.success? | ||
UI.user_error!("Failed to upload file to Asana task: (#{response.code} #{response.message})") | ||
end | ||
rescue Errno::ENOENT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think at least Errno::EPERM
could also be raised here for file that the user has no permission to access, so perhaps we could just use rescue
here:
rescue Errno::ENOENT | |
rescue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Please update lib/fastlane/plugin/ddg_apple_automation/version.rb to 0.4.0 before merging :)
spec/asana_upload_action_spec.rb
Outdated
end | ||
|
||
it "shows error if file does not exist" do | ||
allow(HTTParty).to receive(:post).and_return(double(success?: true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is not needed now 👍
Task URL: https://app.asana.com/0/1201392122292466/1208137627434497/f
Description:
This change adds new lane that replaces asana-upload action