Skip to content

Commit

Permalink
add mock to patch test
Browse files Browse the repository at this point in the history
  • Loading branch information
KateSakharova committed Feb 1, 2024
1 parent 6a55c40 commit 18d4641
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/me/test_metagenomics_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import requests
import responses
from unittest import mock

class TestME:

Expand Down Expand Up @@ -69,8 +70,19 @@ def test_wrong_delete_request_me(self):
with pytest.raises(requests.HTTPError, match="404 Client Error"):
me_api.delete_request(endpoint)

def test_patch_analysis_me(self):
@mock.patch("emgapi.metagenomics_exchange.MetagenomicsExchangeAPI.patch_request")
def test_patch_analysis_me(self,
mock_patch_request):
me_api = MetagenomicsExchangeAPI()
class MockResponse:
def __init__(self, json_data, status_code):
self.json_data = json_data
self.status_code = status_code
self.ok = True
def json(self):
return self.json_data

mock_patch_request.return_value = MockResponse({}, 200)
registry_id = "MGX0000788"
mgya = "MGYA00593709"
run_accession = "SRR3960575"
Expand Down

0 comments on commit 18d4641

Please sign in to comment.