tests: актуализация под телефонию и форматирование телефона

- EmployeeAdminPasswordTests: форма требует internal_line_type (поле
  телефонии, у модели default=ANALOG) — добавлено в данные формы
- EmployeeDetailTests: в чужой карточке телефон отображается
  форматированным (format_ua_phone_display) — проверка обновлена

Полный прогон (.venv): 788 тестов, 0 провалов.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-01 15:47:09 +02:00
parent 1215655569
commit 5fa9fede82
2 changed files with 6 additions and 2 deletions
+1
View File
@@ -365,6 +365,7 @@ class EmployeeAdminPasswordTests(TestCase):
'mattermost_sync_status': emp.mattermost_sync_status,
'ad_sync_status': emp.ad_sync_status,
'default_page_size': emp.default_page_size,
'internal_line_type': emp.internal_line_type,
}
data.update(overrides)
return EmployeeAdminForm(data, instance=emp)
+5 -2
View File
@@ -127,18 +127,21 @@ class EmployeeDetailTests(TestCase):
cls.stranger = make_employee()
def test_staff_sees_pii(self):
from core.utils.validators import format_ua_phone_display
login_2fa(self.client, self.staff)
html = self.client.get(f'/employees/{self.employee.pk}/', HTTP_HX_REQUEST='true').content.decode()
self.assertIn('Личный телефон', html)
self.assertIn('Интеграции', html)
self.assertIn(self.employee.personal_phone, html)
# В карточке другого сотрудника телефон отображается форматированным.
self.assertIn(format_ua_phone_display(self.employee.personal_phone), html)
self.assertIn(self.employee.username, html)
def test_manager_sees_subordinate_pii(self):
from core.utils.validators import format_ua_phone_display
login_2fa(self.client, self.manager)
html = self.client.get(f'/employees/{self.employee.pk}/', HTTP_HX_REQUEST='true').content.decode()
self.assertIn('Личный телефон', html)
self.assertIn(self.employee.personal_phone, html)
self.assertIn(format_ua_phone_display(self.employee.personal_phone), html)
# Логин — только себе и администратору портала, не руководителю.
self.assertNotIn(self.employee.username, html)