Skip to content

Commit

Permalink
Add tests for processing all templates for create_action_item
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoy committed Sep 14, 2024
1 parent 992b00c commit 39301d9
Show file tree
Hide file tree
Showing 21 changed files with 410 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@ def self.run(params)
text = "#{comment}\n\nWorkflow URL: #{workflow_url}"
create_story(asana_access_token, task_id, text: text)
else
template_file = Helper::DdgAppleAutomationHelper.path_for_asset_file("asana_add_comment/templates/#{template_name}.html.erb")
template_content = Helper::DdgAppleAutomationHelper.load_file(template_file)
return unless template_content
html_text = process_template(template_name, args)
sanitized_html_text = Helper::DdgAppleAutomationHelper.sanitize_asana_html_notes(html_text)
create_story(asana_access_token, task_id, html_text: sanitized_html_text)
end
end

erb_template = ERB.new(template_content)
html_text = erb_template.result(binding)
def self.process_template(template_name, args)
template_file = Helper::DdgAppleAutomationHelper.path_for_asset_file("asana_add_comment/templates/#{template_name}.html.erb")
template_content = Helper::DdgAppleAutomationHelper.load_file(template_file)
return unless template_content

html_text = Helper::DdgAppleAutomationHelper.sanitize_asana_html_notes(html_text)
create_story(asana_access_token, task_id, html_text: html_text)
end
erb_template = ERB.new(template_content)
erb_template.result(binding)
end

def self.description
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<body>
πŸ› Debug symbols archive for <%= args['tag'] %> build is uploaded to <code><%= args['dsym_s3_path'] %></code>.<br>
<br>
πŸ”— Workflow URL: <a href='<%= args['worklow_url'] %>'><%= args['workflow_url'] %></a>.
πŸ”— Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
</body>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<body>
πŸ“₯ DMG for <%= args['tag'] %> is available from <a href='<%= args['dmg_url'] %>'><%= args['dmg_url'] %></a>.<br>
<br>
πŸ”— Workflow URL: <a href='<%= args['worklow_url'] %>'><%= args['worklow_url'] %></a>.
πŸ”— Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<li>Point any pull requests with changes required for the hotfix release to that branch.</li>
</ul>
<br>
πŸ”— Workflow URL: <a href='<%= args['worklow_url'] %>'><%= args['worklow_url'] %></a>.
πŸ”— Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
</li>
</ul>
<br>
πŸ”— Workflow URL: <a href='<%= args['worklow_url'] %>'><%= args['worklow_url'] %></a>.
πŸ”— Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
<a data-asana-gid='<%= args['assignee_id'] %>' />, please proceed with manual tagging and merging <a data-asana-gid='<%= args['task_id'] %>'
data-asana-dynamic='false'>according to instructions</a>.<br>
<br>
πŸ”— Workflow URL: <a href='<%= args['worklow_url'] %>'><%= args['worklow_url'] %></a>.
πŸ”— Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
<li>πŸ”± <code><%= args['branch'] %></code> branch has been successfully merged to <code><%= args['base_branch'] %></code>.</li>
</ul>
<br>
πŸ”— Workflow URL: <a href='<%= args['worklow_url'] %>'><%= args['worklow_url'] %></a>.
πŸ”— Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
<a data-asana-gid='<%= args['assignee_id'] %>' />, please proceed with the release <a data-asana-gid='<%= args['task_id'] %>'
data-asana-dynamic='false'>according to instructions</a>.<br>
<br>
πŸ”— Workflow URL: <a href='<%= args['worklow_url'] %>'><%= args['worklow_url'] %></a>.
πŸ”— Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
</li>
</ul>
<br>
πŸ”— Workflow URL: <a href='<%= args['worklow_url'] %>'><%= args['worklow_url'] %></a>.
πŸ”— Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
<li>πŸš€ The relase will be published to Sparkle in a few minutes (you'll get notified).</li>
</ul>
<br>
πŸ”— Workflow URL: <a href='<%= args['worklow_url'] %>'><%= args['worklow_url'] %></a>.
πŸ”— Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
data-asana-gid='<%= args['task_id'] %>' /> which concludes the internal release process.</li>
</ul>
<br>
πŸ”— Workflow URL: <a href='<%= args['worklow_url'] %>'><%= args['worklow_url'] %></a>.
πŸ”— Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
process.</li>
</ul>
<br>
πŸ”— Workflow URL: <a href='<%= args['worklow_url'] %>'><%= args['worklow_url'] %></a>.
πŸ”— Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ html_notes: |
<li>Verify that you're being offered to update to <%= args['tag'] %>.</li>
<li>Verify that the update works.</li>
</ol><br>
πŸ”— Workflow URL: <a href='<%= args['worklow_url'] %>'><%= args['worklow_url'] %></a>.
πŸ”— Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
</body>

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ html_notes: |
<li>Verify that you're being offered to update to <%= args['tag'] %>.</li>
<li>Verify that the update works.</li>
</ol><br>
πŸ”— Workflow URL: <a href='<%= args['worklow_url'] %>'><%= args['worklow_url'] %></a>.
πŸ”— Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
</body>

Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ html_notes: |
<li>Verify that you're being offered to update to <%= args['tag'] %>.</li>
<li>Verify that the update works.</li>
</ol><br>
πŸ”— Workflow URL: <a href='<%= args['worklow_url'] %>'><%= args['worklow_url'] %></a>.
πŸ”— Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ html_notes: |
</ul>
Complete this task when ready, or if the release branch has already been deleted.<br>
<br>
πŸ”— Workflow URL: <a href='<%= args['worklow_url'] %>'><%= args['worklow_url'] %></a>.
πŸ”— Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ html_notes: |
Complete this task when ready and proceed with testing the build. If you're bumping an internal release, you should get another task asking you to publish the release in Sparkle.
Look for other tasks in <a data-asana-gid='<%= args['automation_task_id'] %>'/> task and handle them as needed.<br>
<br>
πŸ”— Workflow URL: <a href='<%= args['worklow_url'] %>'><%= args['worklow_url'] %></a>.
πŸ”— Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ html_notes: |
</ul>
Complete this task when ready and proceed with testing the build.<br>
<br>
πŸ”— Workflow URL: <a href='<%= args['worklow_url'] %>'><%= args['worklow_url'] %></a>.
πŸ”— Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ html_notes: |
</ul><br>
Complete this task when ready.<br>
<br>
πŸ”— Workflow URL: <a href='<%= args['worklow_url'] %>'><%= args['worklow_url'] %></a>.
πŸ”— Workflow URL: <a href='<%= args['workflow_url'] %>'><%= args['workflow_url'] %></a>.
</body>
Loading

0 comments on commit 39301d9

Please sign in to comment.