コード例 #1
0
    def test_should_return_one_movie_snapshot_with_movie_title(
            self, movie_snapshots_repository):
        movie_snapshots_repository.return_value.get_all.return_value = [
            MovieSnapshotsBuilder.snapshot_title("3 idiots").finish()
        ]

        movie_snapshot: MovieSnapshot = MovieSnapshotsService().get_all()[0]
        self.assertEqual("3 idiots", movie_snapshot.title)
コード例 #2
0
    def test_should_return_one_movie_snapshot_with_release_year(
            self, movie_snapshots_repository):
        movie_snapshots_repository.return_value.get_all.return_value = [
            MovieSnapshotsBuilder.any_snapshot().released_on(date(
                2009, 12, 25)).finish()
        ]

        movie_snapshot: MovieSnapshot = MovieSnapshotsService().get_all()[0]
        self.assertEqual(2009, movie_snapshot.release_year)
コード例 #3
0
    def test_should_return_one_movie_snapshot_with_movie_director(
            self, movie_snapshots_repository):
        movie_snapshots_repository.return_value.get_all.return_value = [
            MovieSnapshotsBuilder.any_snapshot().directed_by(
                "Rajkumar").finish()
        ]

        movie_snapshot: MovieSnapshot = MovieSnapshotsService().get_all()[0]
        self.assertEqual("Rajkumar", movie_snapshot.director)
コード例 #4
0
class MovieSnapshotsResource(Resource):
    def __init__(self):
        self.movie_snapshots_service = MovieSnapshotsService()
        self.logger = LoggerFactory.instance().logger()

    @marshal_with(fields=MovieSnapshotsView.DISPLAYABLE_FIELDS)
    def get(self) -> List[MovieSnapshotsView]:
        self.logger.info("Received request for getting all movie snapshots")
        return [
            MovieSnapshotsView.make_from(movie_snapshot)
            for movie_snapshot in self.movie_snapshots_service.get_all()
        ]
コード例 #5
0
 def __init__(self):
     self.movie_snapshots_service = MovieSnapshotsService()
     self.logger = LoggerFactory.instance().logger()
コード例 #6
0
    def test_should_return_one_movie_snapshot(self,
                                              movie_snapshots_repository):
        movie_snapshots_repository.return_value.get_all.return_value = [{}]

        movie_snapshots = MovieSnapshotsService().get_all()
        self.assertEqual(1, len(movie_snapshots))