Ejemplo n.º 1
0
def get_browse_filters():
    logger.info('Retrieving Browse Filters')
    # A list of attributes by which the user can filter the displayed movies
    browse_filters = []

    # Create the Genre filter
    genre_filter = BrowseFilter('genre')

    # Add default option. Not filtered by Genre
    default_option = FilterElement('', 'All')
    genre_filter.option_list.append(default_option)

    # Retrieve list of genres from API
    logger.info('Retrieving Genre List')
    retrieved_genres = Movie.get_genres()
    # Add retrieved genres to list as Genre objects
    for id_, name in retrieved_genres:
        genre = FilterElement(id_, name)
        genre_filter.option_list.append(genre)
    if not retrieved_genres:
        logger.warning('No Genres Retrieved')

    browse_filters.append(genre_filter)

    logger.info('Finished Retrieving Browse Filters')
    return browse_filters
Ejemplo n.º 2
0
 def test_get_movies_for_genre(self):
     genres = Movie.get_genres()
     movies = Movie.get_movies_for_genre(genres[0][0], 1)
     self.assertTrue(movies)
Ejemplo n.º 3
0
 def test_get_genres(self):
     genres = Movie.get_genres()
     self.assertTrue(genres)
Ejemplo n.º 4
0
 def test_get_movies_for_genre(self):
     genres = Movie.get_genres()
     movies = Movie.get_movies_for_genre(genres[0][0], 1)
     self.assertTrue(movies)
Ejemplo n.º 5
0
 def test_get_genres(self):
     genres = Movie.get_genres()
     self.assertTrue(genres)