Skip to content

Commit

Permalink
[TEST]
Browse files Browse the repository at this point in the history
-*added test action message with error
  • Loading branch information
Z3ZEL committed Aug 21, 2023
1 parent 59454d4 commit 2773a55
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/demarches_simpy/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ def __init__(self, profile : Profile, dossier : Dossier, **kwargs) -> None:
self.query_path = './query/actions.graphql'

self.__instructeur_id = None

if not 'no_instructeur_id' in kwargs:
if not profile.has_instructeur_id() and not 'instructeur_id' in kwargs:
self.error('No instructeur id was provided to the profile, cannot send message.')
if 'instructeur_id' in kwargs:
self.__instructeur_id = kwargs['instructeur_id']

#Test instructeur id
self.instructeur_id


if 'query_path' in kwargs:
Expand Down
15 changes: 14 additions & 1 deletion tests/test_actions_api_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from os import getenv
sys.path.append('..')
from src.demarches_simpy import StateModifier, Profile, Demarche, Dossier, DossierState, MessageSender, AnnotationModifier, FileUploader

from src.demarches_simpy.utils import DemarchesSimpyException
load_dotenv()

API_DS_KEY = getenv("API_DS_KEY", False)
Expand Down Expand Up @@ -102,3 +102,16 @@ def test_file_uploader_with_no_error(self, dossier : Dossier, file_uploader : Fi



class TestActionMessageModifierError():
@pytest.fixture
def dossier(self) -> Dossier:
dossier = demarche.get_dossiers()[0]
return dossier

def test_create_sender_without_instructor_id(self, dossier : Dossier) -> MessageSender:
with pytest.raises(DemarchesSimpyException):
sender = MessageSender(profile=profile, dossier=dossier)
print(sender.instructeur_id)



0 comments on commit 2773a55

Please sign in to comment.