Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1157] Added User.phonenumber to profile page #490

Merged
merged 1 commit into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/open_inwoner/accounts/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class _UserAdmin(UserAdmin):
"housenumber",
"postcode",
"city",
"phonenumber",
"selected_themes",
)
},
Expand Down
1 change: 1 addition & 0 deletions src/open_inwoner/accounts/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Meta:
lambda o: "%s%[email protected]" % (o.first_name, random.randint(0, 10000))
)
password = factory.PostGenerationMethodCall("set_password", "secret")
phonenumber = factory.Faker("numerify", text="06########")


class DigidUserFactory(UserFactory):
Expand Down
10 changes: 9 additions & 1 deletion src/open_inwoner/accounts/tests/test_profile_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ProfileViewTests(WebTest):
def setUp(self):
self.url = reverse("accounts:my_profile")
self.return_url = reverse("logout")
self.user = UserFactory()
self.user = UserFactory(street="MyStreet")

self.action_deleted = ActionFactory(
name="deleted action, should not show up",
Expand All @@ -35,6 +35,14 @@ def test_login_required(self):
response = self.app.get(self.url)
self.assertRedirects(response, f"{login_url}?next={self.url}")

def test_user_information_profile_page(self):
response = self.app.get(self.url, user=self.user)

self.assertContains(response, self.user.get_full_name())
self.assertContains(response, self.user.email)
self.assertContains(response, self.user.phonenumber)
self.assertContains(response, self.user.get_address())

def test_get_empty_profile_page(self):
response = self.app.get(self.url, user=self.user)

Expand Down
3 changes: 2 additions & 1 deletion src/open_inwoner/templates/pages/profile/me.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ <h1 class="h1" id="title">
<div class="personal-information__block personal-information__block--bold">
{% icon icon="person_outline" %}<br>
{{ request.user.get_full_name }}<br>
{{ request.user.email }}<br>
{{ request.user.email }}<br>
{% if request.user.phonenumber %}{{ request.user.phonenumber }}<br>{% endif %}
{% if request.user.get_address %}{{ request.user.get_address }}{% else %}-{% endif %}
</div>
<div class="personal-information__block">
Expand Down