Example #1
0
def test_poll_success(monkeypatch):
    def patch_check(rid):
        return True

    monkeypatch.setattr(remote, "check", patch_check)

    assert remote.check("RID") is True
Example #2
0
def test_check(check_response):
    with requests_mock.Mocker() as mock:
        mock.get(remote.BLAST_API_URL, text=check_response)

        # Finds Status=READY and ThereAreHits=yes
        assert remote.check("VCZM3MWB014") is True

        # Check correct request URL
        assert mock.request_history[0].url == (
            "https://blast.ncbi.nlm.nih.gov/Blast.cgi?"
            "CMD=Get"
            "&RID=VCZM3MWB014"
            "&FORMAT_OBJECT=SearchInfo")
Example #3
0
def test_check_waiting():
    with requests_mock.Mocker() as mock:
        mock.get(remote.BLAST_API_URL, text="Status=WAITING\n")
        assert remote.check("RID") is False
Example #4
0
def test_check_failed(text):
    with requests_mock.Mocker() as mock, pytest.raises(ValueError):
        mock.get(remote.BLAST_API_URL, text=text)
        remote.check("RID")