Skip to content

Commit

Permalink
Test urls and images [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Dec 28, 2021
1 parent ef5514c commit 2689f1e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test/internal/config/blazer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ audit: true
from_email: blazer@example.org

# webhook for Slack
slack_webhook_url: http://localhost:5000
slack_webhook_url: http://localhost:3000

check_schedules:
- "1 day"
Expand Down
21 changes: 21 additions & 0 deletions test/queries_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,25 @@ def test_csv
run_query("SELECT 1 AS id, 'Chicago' AS city", format: "csv")
assert_equal "id,city\n1,Chicago\n", response.body
end

def test_url
run_query "SELECT 'http://localhost:3000/'"
assert_match %{<a target="_blank" href="http://localhost:3000/">http://localhost:3000/</a>}, response.body
end

def test_images_default
run_query("SELECT 'http://localhost:3000/image.png'")
refute_match %{<img referrerpolicy="no-referrer" src="http://localhost:3000/image.png" />}, response.body
end

def test_images
previous_value = Blazer.images
begin
Blazer.images = true
run_query("SELECT 'http://localhost:3000/image.png'")
assert_match %{<img referrerpolicy="no-referrer" src="http://localhost:3000/image.png" />}, response.body
ensure
Blazer.images = previous_value
end
end
end

0 comments on commit 2689f1e

Please # to comment.