mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-23 08:51:30 -05:00
This deletes a big ol' chunk of code related to letters. It's not everything—there are still a few things that might be tied to sms/email—but it's the the heart of letters function. SMS and email function should be untouched by this. Areas affected: - Things obviously about letters - PDF tasks, used for precompiling letters - Virus scanning, used for those PDFs - FTP, used to send letters to the printer - Postage stuff
25 lines
1.1 KiB
Python
25 lines
1.1 KiB
Python
from app.dao.permissions_dao import permission_dao
|
|
from tests.app.db import create_service
|
|
|
|
|
|
def test_get_permissions_by_user_id_returns_all_permissions(sample_service):
|
|
permissions = permission_dao.get_permissions_by_user_id(user_id=sample_service.users[0].id)
|
|
assert len(permissions) == 7
|
|
assert sorted(["manage_users",
|
|
"manage_templates",
|
|
"manage_settings",
|
|
"send_texts",
|
|
"send_emails",
|
|
"manage_api_keys",
|
|
"view_activity"]) == sorted([i.permission for i in permissions])
|
|
|
|
|
|
def test_get_permissions_by_user_id_returns_only_active_service(sample_user):
|
|
active_service = create_service(user=sample_user, service_name="Active service")
|
|
inactive_service = create_service(user=sample_user, service_name="Inactive service", active=False)
|
|
|
|
permissions = permission_dao.get_permissions_by_user_id(user_id=sample_user.id)
|
|
assert len(permissions) == 7
|
|
assert active_service in [i.service for i in permissions]
|
|
assert inactive_service not in [i.service for i in permissions]
|