-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: refactor to have app creation in conftest
* the init_common has to be called too. this is necessary that the test with the extend security forms is working.
- Loading branch information
1 parent
d00c7d9
commit d6d795a
Showing
2 changed files
with
18 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,17 +26,13 @@ def prefix(name, data): | |
return data | ||
|
||
|
||
def test_profile_in_registration(base_app): | ||
def test_profile_in_registration(app_with_extend_security_forms): | ||
"""Test accounts registration form.""" | ||
base_app.config.update(USERPROFILES_EXTEND_SECURITY_FORMS=True) | ||
InvenioUserProfiles(base_app) | ||
base_app.register_blueprint(blueprint_ui_init) | ||
app = base_app | ||
|
||
with app.test_request_context(): | ||
with app_with_extend_security_forms.test_request_context(): | ||
register_url = url_for_security("register") | ||
|
||
with app.test_client() as client: | ||
with app_with_extend_security_forms.test_client() as client: | ||
resp = client.get(register_url) | ||
assert "profile.username" in resp.get_data(as_text=True) | ||
assert "profile.full_name" in resp.get_data(as_text=True) | ||
|
@@ -50,13 +46,13 @@ def test_profile_in_registration(base_app): | |
} | ||
resp = client.post(register_url, data=data, follow_redirects=True) | ||
|
||
with app.test_request_context(): | ||
with app_with_extend_security_forms.test_request_context(): | ||
user = User.query.filter_by(email="[email protected]").one() | ||
assert user.username == "TestUser" | ||
assert user.user_profile["full_name"] == "Test C. User" | ||
assert user.user_profile["affiliations"] == "Test Org" | ||
|
||
with app.test_client() as client: | ||
with app_with_extend_security_forms.test_client() as client: | ||
resp = client.get(register_url) | ||
data = { | ||
"email": "[email protected]", | ||
|