Skip to content

Commit

Permalink
Fixed tests in combination with newer plone.app.z3cform. (#1603)
Browse files Browse the repository at this point in the history
See plone/plone.app.z3cform#162

Instead of

```
<input id="__ac_password" name="__ac_password"
```

we get:

```
<input class="form-control password-widget required password-field" id="__ac_password" name="__ac_password" type="password" />
```
  • Loading branch information
mauritsvanrees committed Mar 22, 2023
1 parent 7696dc7 commit acca00e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions news/162.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed tests in combination with newer ``plone.app.z3cform``.
[maurits]
12 changes: 10 additions & 2 deletions src/plone/restapi/tests/test_functional_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@


class TestFunctionalAuth(unittest.TestCase):

layer = PLONE_RESTAPI_DX_FUNCTIONAL_TESTING

def setUp(self):
Expand Down Expand Up @@ -173,8 +172,17 @@ def test_cookie_login_grants_api(self):
200,
"Wrong Plone login challenge status code",
)
# The input differs slightly per Plone version.
self.assertTrue(
"<input" in challenge_resp.text,
"Plone login challenge response content missing input",
)
self.assertTrue(
'id="__ac_password"' in challenge_resp.text,
"Plone login challenge response content missing password field",
)
self.assertTrue(
'<input id="__ac_password" name="__ac_password"' in challenge_resp.text,
'name="__ac_password"' in challenge_resp.text,
"Plone login challenge response content missing password field",
)
login_resp = session.post(
Expand Down

0 comments on commit acca00e

Please sign in to comment.