예제 #1
0
    def test_get_success(self, simple_country):
        # arrange
        expected_country = CountryDBRepo.decode_orm_country(simple_country)
        test_id = simple_country.id

        # act
        result_country = CountryDBRepo.get(country_id=test_id)

        # assert
        assert result_country.name == expected_country.name
예제 #2
0
    def test_get_all_success(self, countries_20):
        # arrange
        expected_countries = []
        for g in countries_20:
            expected_countries.append(CountryDBRepo.decode_orm_country(g))

        # act
        result_countries = CountryDBRepo.get_all()

        # assert
        for i in range(len(expected_countries)):
            assert result_countries[i].name == expected_countries[i].name
예제 #3
0
    def decode_orm_film(orm_film) -> Film:
        genres = []
        for g in orm_film.genres.all():
            genres.append(GenreDBRepo.decode_orm_genre(g))

        actors = []
        for a in orm_film.actors.all():
            actors.append(ActorDBRepo.decode_orm_actor(a))

        countries = []
        for g in orm_film.countries.all():
            countries.append(CountryDBRepo.decode_orm_country(g))

        return Film(title=orm_film.title,
                    year=orm_film.year,
                    description=orm_film.description,
                    id=orm_film.id,
                    genres=genres,
                    actors=actors,
                    countries=countries,
                    image=orm_film.image,
                    created=orm_film.created_at,
                    rating=orm_film.rating,
                    )