Skip to content

Commit 1c6951a

Browse files
kpshervarerowep
authored andcommitted
release: v2.1.0
1 parent 8a2dce3 commit 1c6951a

File tree

9 files changed

+83
-4
lines changed

9 files changed

+83
-4
lines changed

CHANGES.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
Changes
99
=======
1010

11+
Version 2.1.0. (released 2023-03-02)
12+
13+
- remove deprecated flask_babelex imports
14+
- install invenio_i18n explicitly
15+
1116
Version 2.0.5 (released 2022-12-14)
1217

1318
- forms: add helper for preferences form

invenio_userprofiles/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from .ext import InvenioUserProfiles
3131
from .models import UserProfile, UserProfileProxy
3232

33-
__version__ = "2.0.5"
33+
__version__ = "2.1.0"
3434

3535
__all__ = (
3636
"__version__",

invenio_userprofiles/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from invenio_i18n import lazy_gettext as _
1818
from wtforms import BooleanField, FormField, RadioField, SelectField, \
1919
StringField, SubmitField
20-
from wtforms.fields.html5 import DateField
20+
from wtforms.fields import DateField
2121
from wtforms.validators import DataRequired, EqualTo, Length, Optional, \
2222
Regexp, StopValidation, ValidationError
2323
from wtforms_components import read_only

invenio_userprofiles/models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"""Database models for user profiles."""
1010

1111
from flask import current_app
12+
from invenio_db import db
13+
from sqlalchemy.ext.hybrid import hybrid_property
1214

1315

1416
class AnonymousUserProfile:

invenio_userprofiles/version.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# This file is part of Invenio.
4+
# Copyright (C) 2015-2018 CERN.
5+
#
6+
# Invenio is free software; you can redistribute it and/or modify it
7+
# under the terms of the MIT License; see LICENSE file for more details.
8+
9+
"""Version information for Invenio-UserProfiles.
10+
11+
This file is imported by ``invenio_userprofiles.__init__``,
12+
and parsed by ``setup.py``.
13+
"""
14+
15+
from __future__ import absolute_import, print_function
16+
17+
__version__ = '1.2.3'

invenio_userprofiles/views.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
register_form_factory,
3939
)
4040
from .models import UserProfileProxy
41-
>>>>>>> 2cdf2e5 (migrate to use black as opinionated auto formater)
4241

4342
blueprint = Blueprint(
4443
"invenio_userprofiles",

pytest.ini

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# This file is part of Invenio.
4+
# Copyright (C) 2015-2018 CERN.
5+
#
6+
# Invenio is free software; you can redistribute it and/or modify it
7+
# under the terms of the MIT License; see LICENSE file for more details.
8+
9+
[pytest]
10+
addopts = --black --isort --pydocstyle --pycodestyle --doctest-glob="*.rst" --doctest-modules --cov=invenio_userprofiles --cov-report=term-missing
11+
testpaths = tests invenio_userprofiles

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,5 @@ ignore =
9898
*-requirements.txt
9999

100100
[tool:pytest]
101-
addopts = --black --isort --pydocstyle --doctest-glob="*.rst" --doctest-modules --cov=invenio_userprofiles --cov-report=term-missing
101+
addopts =--isort --pydocstyle --doctest-glob="*.rst" --doctest-modules --cov=invenio_userprofiles --cov-report=term-missing
102102
testpaths = tests invenio_userprofiles

tests/test_admin.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# This file is part of Invenio.
4+
# Copyright (C) 2016-2018 CERN.
5+
#
6+
# Invenio is free software; you can redistribute it and/or modify it
7+
# under the terms of the MIT License; see LICENSE file for more details.
8+
9+
from flask import Flask, url_for
10+
from flask_admin import Admin
11+
from invenio_admin import InvenioAdmin
12+
from invenio_db import db
13+
14+
from invenio_userprofiles import InvenioUserProfiles
15+
from invenio_userprofiles.admin import UserProfileView, user_profile_adminview
16+
17+
18+
def test_admin(app):
19+
"""Test flask-admin interace."""
20+
InvenioUserProfiles(app)
21+
22+
assert isinstance(user_profile_adminview, dict)
23+
24+
assert 'model' in user_profile_adminview
25+
assert 'modelview' in user_profile_adminview
26+
27+
admin = Admin(app, name="Test")
28+
29+
user_model = user_profile_adminview.pop('model')
30+
user_view = user_profile_adminview.pop('modelview')
31+
admin.add_view(user_view(user_model, db.session,
32+
**user_profile_adminview))
33+
34+
with app.test_request_context():
35+
request_url = url_for('userprofile.index_view')
36+
37+
with app.app_context():
38+
with app.test_client() as client:
39+
res = client.get(
40+
request_url,
41+
follow_redirects=True
42+
)
43+
assert res.status_code == 200
44+
assert b'Username' in (res.get_data())
45+
assert b'Full Name' in (res.get_data())

0 commit comments

Comments
 (0)