Skip to content

Instantly share code, notes, and snippets.

@hudsonbrendon
Last active August 15, 2022 05:44
Show Gist options
  • Select an option

  • Save hudsonbrendon/165bd46fe9aca817e408564331d5bca3 to your computer and use it in GitHub Desktop.

Select an option

Save hudsonbrendon/165bd46fe9aca817e408564331d5bca3 to your computer and use it in GitHub Desktop.
from requests.models import Response
from ingresso import Ingresso, __version__
def test_version():
assert __version__ == "0.1.0"
class TestIngresso:
def test_init(
self,
ingresso,
):
assert isinstance(
ingresso,
Ingresso,
)
def test_city_id(
self,
ingresso,
):
assert ingresso.city_id == 48
def test_partnership(
self,
ingresso,
):
assert ingresso.partnership == "cinepolis"
def test_url(
self,
ingresso,
):
assert ingresso.url == "https://api-content.ingresso.com/v0/"
def test_get_full_url(
self,
ingresso,
):
assert ingresso.get_full_url("cinemas") == "https://api-content.ingresso.com/v0/cinemas"
def test_request(
self,
ingresso,
):
assert isinstance(
ingresso.request("cinemas"),
Response,
)
def test_now_playing(
self,
requests_mock,
ingresso,
now_playing,
):
url = f'{ingresso.get_full_url(path=f"templates/nowplaying/city/{ingresso.city_id}/")}?partnership={ingresso.partnership}'
requests_mock.get(
url=url,
json=now_playing,
)
assert now_playing == ingresso.now_playing()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment