Problem/Motivation

To help test other functionality in the module, it would be useful if it was clear when tests should receive a 200 or 403 HTTP status response.

Proposed resolution

Extend the test coverage to make it clear what requests should give a 200 or 403 response.

Remaining tasks

Improve MasqueradeAccessTest to add status checks for the HTTP response.

User interface changes

n/a

API changes

n/a

Data model changes

n/a

Comments

DamienMcKenna created an issue. See original summary.

damienmckenna’s picture

StatusFileSize
new2.14 KB

Starting point, that fails locally, because some page requests give a 403 response.

damienmckenna’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: masquerade-n3377262-2.patch, failed testing. View results

andypost’s picture

+++ b/tests/src/Functional/MasqueradeAccessTest.php
@@ -131,7 +134,9 @@ protected function assertCanMasqueradeAs(AccountInterface $target_account) {
+    $this->assertSession()->statusCodeEquals(200);
     $this->submitForm($edit, 'Switch');
+    $this->assertSession()->statusCodeEquals(200);
     $this->assertSession()
       ->responseNotContains($this->t('You are not allowed to masquerade as %name.', [

Test said it's line MasqueradeAccessTest.php:139 but not the submitForm()

andypost’s picture

I mean as expected result is 403 then no reason to try submit form

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new2.56 KB

This passes locally.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Thank you! I find it ready to commit

andypost’s picture

Status: Reviewed & tested by the community » Fixed

Commited to 8.x-2.x

damienmckenna’s picture

Thank you for the quick commit!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.