File: test_search.py

package info (click to toggle)
python-tmdbsimple 2.9.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 348 kB
  • sloc: python: 2,231; makefile: 4
file content (74 lines) | stat: -rw-r--r-- 1,803 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# -*- coding: utf-8 -*-

"""
test_search.py
~~~~~~~~~~~~~~

This test suite checks the methods of the Search class of tmdbsimple.

Created by Celia Oakley on 2013-11-05

:copyright: (c) 2013-2022 by Celia Oakley.
:license: GPLv3, see LICENSE for more details.
"""

import unittest
import tmdbsimple as tmdb

from tests import API_KEY
tmdb.API_KEY = API_KEY

"""
Constants
"""
QUERY_1 = 'Club'
QUERY_2 = 'Avenger'
QUERY_3 = 'Breaking'
QUERY_4 = 'Brad Pitt'
QUERY_6 = 'Sony Pictures'
QUERY_7 = 'fight'
QUERY_8 = 'blackjack'


class SearchTestCase(unittest.TestCase):
    def test_search_company(self):
        query = QUERY_6
        search = tmdb.Search()
        search.company(query=query)
        self.assertTrue(hasattr(search, 'results'))

    def test_search_collection(self):
        query = QUERY_2
        search = tmdb.Search()
        search.collection(query=query)
        self.assertTrue(hasattr(search, 'results'))

    def test_search_keyword(self):
        query = QUERY_7
        search = tmdb.Search()
        search.keyword(query=query)
        self.assertTrue(hasattr(search, 'results'))

    def test_search_movie(self):
        query = QUERY_1
        search = tmdb.Search()
        search.movie(query=query)
        self.assertTrue(hasattr(search, 'results'))

    def test_search_multi(self):
        query = QUERY_8
        search = tmdb.Search()
        search.multi(query=query)
        self.assertTrue(hasattr(search, 'results'))

    def test_search_person(self):
        query = QUERY_4
        search = tmdb.Search()
        search.person(query=query)
        self.assertTrue(hasattr(search, 'results'))

    def test_search_tv(self):
        query = QUERY_3
        search = tmdb.Search()
        search.tv(query=query)
        self.assertTrue(hasattr(search, 'results'))