Introduce CSP headers to Kalamar (start of #72)
Change-Id: I84b7ff0accab3d783ad653fae123c25fee1d92b9
diff --git a/t/plugin/auth-oauth.t b/t/plugin/auth-oauth.t
index 117b690..22054d2 100644
--- a/t/plugin/auth-oauth.t
+++ b/t/plugin/auth-oauth.t
@@ -97,6 +97,7 @@
}
);
+my $q = qr!(?:\"|")!;
$t->get_ok('/realapi/v1.0')
->status_is(200)
@@ -106,7 +107,7 @@
->status_is(200)
->text_like('h1 span', qr/KorAP: Find .Baum./i)
->text_like('#total-results', qr/\d+$/)
- ->content_like(qr/\"authorized\"\:null/)
+ ->content_like(qr/${q}authorized${q}:null/)
->element_exists_not('div.button.top a')
->element_exists_not('aside.active')
->element_exists_not('aside.off')
@@ -216,7 +217,7 @@
->text_like('h1 span', qr/KorAP: Find .Baum./i)
->text_like('#total-results', qr/\d+$/)
->element_exists_not('div.notify-error')
- ->content_like(qr/\"authorized\"\:\"yes\"/)
+ ->content_like(qr/${q}authorized${q}:${q}yes${q}/)
->element_exists('div.button.top a')
->element_exists('div.button.top a.logout[title~="test"]')
;
@@ -225,7 +226,7 @@
->status_is(200)
->text_like('h1 span', qr/KorAP: Find .Paum./i)
->text_is('#total-results', '')
- ->content_like(qr/\"authorized\"\:\"yes\"/)
+ ->content_like(qr/${q}authorized${q}:${q}yes${q}/)
->element_exists_not('p.hint')
;
@@ -251,14 +252,14 @@
->status_is(200)
->text_like('h1 span', qr/KorAP: Find .Baum./i)
->text_like('#total-results', qr/\d+$/)
- ->content_like(qr/\"authorized\"\:null/)
+ ->content_like(qr/${q}authorized${q}:null/)
;
$t->get_ok('/?q=Paum')
->status_is(200)
->text_like('h1 span', qr/KorAP: Find .Paum./i)
->text_is('#total-results', '')
- ->content_like(qr/\"authorized\"\:null/)
+ ->content_like(qr/${q}authorized${q}:null/)
->text_is('p.hint', 'Maybe you need to log in first?')
;
@@ -320,7 +321,7 @@
->status_is(200)
->text_like('h1 span', qr/KorAP: Find .Baum./i)
->text_like('#total-results', qr/\d+$/)
- ->content_like(qr/\"authorized\"\:\"yes\"/)
+ ->content_like(qr/${q}authorized${q}:${q}yes${q}/)
->header_is('X-Kalamar-Cache', 'true')
;
@@ -333,9 +334,9 @@
->text_is('title', 'KorAP: Find »baum« with Poliqarp')
->element_exists('meta[name="DC.title"][content="KorAP: Find »baum« with Poliqarp"]')
->element_exists('body[itemscope][itemtype="http://schema.org/SearchResultsPage"]')
- ->content_like(qr/\"authorized\"\:\"yes\"/)
+ ->content_like(qr/${q}authorized${q}:${q}yes${q}/)
->header_isnt('X-Kalamar-Cache', 'true')
- ->content_like(qr!\"cutOff":true!)
+ ->content_like(qr!${q}cutOff${q}:true!)
->element_exists_not('#total-results')
;
@@ -364,7 +365,7 @@
->text_is('title', 'KorAP: Find »baum« with Poliqarp')
->element_exists('meta[name="DC.title"][content="KorAP: Find »baum« with Poliqarp"]')
->element_exists('body[itemscope][itemtype="http://schema.org/SearchResultsPage"]')
- ->content_unlike(qr/\"authorized\"\:\"yes\"/)
+ ->content_unlike(qr/${q}authorized${q}:${q}yes${q}/)
->header_isnt('X-Kalamar-Cache', 'true')
->element_exists('p.no-results')
;
@@ -385,7 +386,7 @@
->text_is('title', 'KorAP: Find »baum« with Poliqarp')
->element_exists('meta[name="DC.title"][content="KorAP: Find »baum« with Poliqarp"]')
->element_exists('body[itemscope][itemtype="http://schema.org/SearchResultsPage"]')
- ->content_like(qr/\"authorized\"\:\"yes\"/)
+ ->content_like(qr/${q}authorized${q}:${q}yes${q}/)
->header_isnt('X-Kalamar-Cache', 'true')
->element_exists_not('p.no-results')
;
@@ -405,7 +406,7 @@
->text_is('#error','')
->text_is('div.notify-error','Refresh token is expired')
->text_is('title', 'KorAP: Find »baum« with Poliqarp')
- ->content_unlike(qr/\"authorized\"\:\"yes\"/)
+ ->content_unlike(qr/${q}authorized${q}:${q}yes${q}/)
->element_exists('p.no-results')
->tx->res->dom->at('input[name="csrf_token"]')
->attr('value')