From 57da5f1a9ece3d261f16a0fc6f7ea1f86bc9c6e5 Mon Sep 17 00:00:00 2001 From: NolanB <nboukachab@teklia.com> Date: Wed, 31 Aug 2022 18:19:10 +0200 Subject: [PATCH] Modif code with the review --- tests/test_elements_worker/test_entities.py | 25 ++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/tests/test_elements_worker/test_entities.py b/tests/test_elements_worker/test_entities.py index 2774e15e..70ca3769 100644 --- a/tests/test_elements_worker/test_entities.py +++ b/tests/test_elements_worker/test_entities.py @@ -659,6 +659,9 @@ def test_list_transcription_entities(fake_dummy_worker): <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> a8b7730... Modif code with the review ======= >>>>>>> a8b7730... Modif code with the review @pytest.mark.parametrize( @@ -672,6 +675,7 @@ def test_list_transcription_entities(fake_dummy_worker): ], ) def test_list_corpus_entities(fake_dummy_worker, name, parent): +<<<<<<< HEAD <<<<<<< HEAD corpus = Corpus({"id": "fake_corpus_id"}) query_params = {} @@ -722,20 +726,31 @@ def test_list_corpus_entities(fake_dummy_worker): >>>>>>> a8b7730... Modif code with the review ======= def test_list_corpus_entities(fake_dummy_worker): +======= +>>>>>>> a8b7730... Modif code with the review corpus = Corpus({"id": "fake_corpus_id"}) - name = "fake_name" - parent = "fake_parent" + query_params = {} + if name is not None: + query_params["name"] = name + if parent is not None: + query_params["parent"] = parent + if type(parent) == Element: + query_params["parent"] = parent.id + fake_dummy_worker.api_client.add_response( "ListCorpusEntities", id=corpus.id, - name=name, - parent=parent, response={"id": "fake_entity_id"}, + **query_params, ) - assert fake_dummy_worker.list_corpus_entities(corpus, name, parent) == { + + assert fake_dummy_worker.list_corpus_entities(corpus, **query_params) == { "id": "fake_entity_id" } +<<<<<<< HEAD >>>>>>> fb7d0b7... Add a list_corpus_entities() method to entity.py +======= +>>>>>>> a8b7730... Modif code with the review assert len(fake_dummy_worker.api_client.history) == 1 assert len(fake_dummy_worker.api_client.responses) == 0 -- GitLab