extend mantishub tests
This commit is contained in:
parent
ce4ff656de
commit
a239a18a8b
|
@ -1,17 +1,26 @@
|
||||||
import json
|
import json
|
||||||
|
import requests
|
||||||
|
|
||||||
from todoist_interface.mantishub import MantishubAPI
|
from todoist_interface.mantishub import MantishubAPI
|
||||||
|
|
||||||
|
import mocks
|
||||||
|
|
||||||
|
|
||||||
def test_mantishub_init():
|
def test_mantishub_init():
|
||||||
mantishub = MantishubAPI("mantistoken")
|
mantishub = MantishubAPI("mantistoken")
|
||||||
assert mantishub.token == "mantistoken"
|
assert mantishub.token == "mantistoken"
|
||||||
|
|
||||||
|
|
||||||
def test_mantishub_get_tickets():
|
def test_mantishub_get_tickets(monkeypatch, example_tickets):
|
||||||
|
|
||||||
|
def mock_get(*args, **kwargs):
|
||||||
|
return mocks.MockResponse(example_tickets)
|
||||||
|
|
||||||
|
# apply the monkeypatch for requests.get to mock_get
|
||||||
|
monkeypatch.setattr(requests, "get", mock_get)
|
||||||
mantishub = MantishubAPI("mantistoken")
|
mantishub = MantishubAPI("mantistoken")
|
||||||
tickets = mantishub.get_tickets()
|
tickets = mantishub.get_tickets()
|
||||||
assert len(tickets) > 0
|
assert tickets[0]['content'] == "[Sample issue title](https://contria.mantishub.io/view.php?id=1)"
|
||||||
|
|
||||||
|
|
||||||
def test_covert_to_todoist(example_tickets):
|
def test_covert_to_todoist(example_tickets):
|
||||||
|
|
Loading…
Reference in New Issue