forked from inveniosoftware/invenio-communities
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resources: [inveniosoftware#855] add POST request_membership
- Loading branch information
Showing
10 changed files
with
273 additions
and
9 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
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
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
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
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 |
---|---|---|
|
@@ -143,6 +143,8 @@ def app_config(app_config): | |
# When testing unverified users, there is a "unverified_user" fixture for that purpose. | ||
app_config["ACCOUNTS_DEFAULT_USERS_VERIFIED"] = True | ||
|
||
app_config["COMMUNITIES_ALLOW_MEMBERSHIP_REQUESTS"] = True | ||
|
||
return app_config | ||
|
||
|
||
|
@@ -361,6 +363,45 @@ def new_user(UserFixture, app, database): | |
return u | ||
|
||
|
||
@pytest.fixture(scope="function") | ||
def create_user(UserFixture, app, db): | ||
"""Create user factory fixture. | ||
It's function scope is key here as it guarantees a user devoid of any prior which | ||
is essential for many tests. | ||
""" | ||
|
||
def _create_user(data): | ||
"""Create user.""" | ||
default_data = dict( | ||
email="[email protected]", | ||
password="user", | ||
username="user", | ||
user_profile={ | ||
"full_name": "Created User", | ||
"affiliations": "CERN", | ||
}, | ||
preferences={ | ||
"visibility": "public", | ||
"email_visibility": "restricted", | ||
"notifications": { | ||
"enabled": True, | ||
}, | ||
}, | ||
active=True, | ||
confirmed=True, | ||
) | ||
actual_data = dict(default_data, **data) | ||
u = UserFixture(**actual_data) | ||
u.create(app, db) | ||
current_users_service.indexer.process_bulk_queue() | ||
current_users_service.record_cls.index.refresh() | ||
db.session.commit() | ||
return u | ||
|
||
return _create_user | ||
|
||
|
||
# | ||
# Communities | ||
# | ||
|
Oops, something went wrong.