fix contact for admin
This commit is contained in:
1 parent
f4fa16d9e7
commit
5fc9a908c5
2 files changed
+34
-1
No files matched your search
@@ -232,6 +232,31 @@ def test_staff_operations_pages_respect_unit_scoped_permissions(client):
|
||||
assert client.get(reverse("staff_tickets:sms_templates")).status_code == 200
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_superuser_without_staff_profile_can_open_all_staff_contacts(client):
|
||||
unit = OrganizationalUnit.objects.create(name="واحد مخاطبان مدیر", slug="admin-contacts-unit")
|
||||
contact = make_contact("admin-visible-contact", "09120000503")
|
||||
group = ContactGroup.objects.create(name="گروه قابل مشاهده مدیر", unit=unit)
|
||||
contact.customer_profile.groups.add(group)
|
||||
User.objects.create_user(
|
||||
username="customer-without-profile",
|
||||
mobile="09120000504",
|
||||
account_type=User.AccountType.CUSTOMER,
|
||||
)
|
||||
admin = User.objects.create_superuser(
|
||||
username="contacts-admin",
|
||||
password="safe-password",
|
||||
account_type=User.AccountType.STAFF,
|
||||
)
|
||||
|
||||
client.force_login(admin)
|
||||
response = client.get(reverse("staff_tickets:contacts"))
|
||||
|
||||
assert response.status_code == 200
|
||||
assert "admin-visible-contact" in response.content.decode()
|
||||
assert "customer-without-profile" not in response.content.decode()
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_unit_scoped_add_ticket_preserves_contact_ownership_and_stakeholder(client):
|
||||
unit=OrganizationalUnit.objects.create(name="حسابداری عملیاتی",slug="accounting-ops")
|
||||
|
||||
Reference in new issue
Block a user