Esempio n. 1
0
    def test_change_solution(self, product: Product):
        solution = ReleaseInfosSolution()

        product.release_infos = HistoricalReleases([
            Release(date(2020, 1, 2), Price(12000)),
            Release(date(2023, 2, 2), Price(12000)),
            Release(date(2028, 1, 2), Price(12000)),
        ])
        product.release_infos.sort()

        p_m = ProductModel.create(
            name="foo",
            release_infos=[
                ProductReleaseInfo(initial_release_date=date(2020, 1, 2),
                                   price=12000),
                ProductReleaseInfo(initial_release_date=date(2023, 2, 2),
                                   price=12000),
                ProductReleaseInfo(initial_release_date=date(2028, 2, 2),
                                   price=12000),
            ])

        solution.set_situation(ReleaseInfosStatus.CHANGE).execute(
            product_dataclass=product, product_model=p_m)

        assert ReleaseInfoHelper.compare_infos(
            product.release_infos,
            p_m.release_infos) is ReleaseInfosStatus.SAME
Esempio n. 2
0
    def test_new_release(self):
        release_infos = HistoricalReleases([
            Release(date(2020, 1, 2), Price(12000)),
            Release(date(2023, 2, 2), Price(12000)),
            Release(date(2028, 2, 2), Price(12000)),
        ])

        p_m = ProductModel.create(
            name="foo",
            release_infos=[
                ProductReleaseInfo(initial_release_date=date(2020, 2, 2),
                                   price=12000),
                ProductReleaseInfo(initial_release_date=date(2023, 2, 2),
                                   price=12000),
            ])

        assert ReleaseInfoHelper.compare_infos(
            release_infos, p_m.release_infos) == ReleaseInfosStatus.NEW_RELEASE
Esempio n. 3
0
    def test_last_release_date_was_brought_forward(self):
        release_infos = HistoricalReleases([
            Release(date(2020, 1, 2), Price(12000)),
            Release(date(2023, 2, 2), Price(12000)),
            Release(date(2028, 1, 2), Price(12000)),
        ])

        p_m = ProductModel.create(
            name="foo",
            release_infos=[
                ProductReleaseInfo(initial_release_date=date(2020, 1, 2),
                                   price=12000),
                ProductReleaseInfo(initial_release_date=date(2023, 2, 2),
                                   price=12000),
                ProductReleaseInfo(initial_release_date=date(2028, 2, 2),
                                   price=12000),
            ])

        assert ReleaseInfoHelper.compare_infos(
            release_infos, p_m.release_infos) == ReleaseInfosStatus.CHANGE
Esempio n. 4
0
    def test_delay_has_been_confirmed(self):
        release_infos = HistoricalReleases([
            Release(date(2019, 1, 2), Price(12000)),
            Release(date(2020, 5, 2), Price(12000)),
            Release(date(2023, 2, 2), Price(12000)),
        ])

        p_m = ProductModel.create(
            name="foo",
            release_infos=[
                ProductReleaseInfo(initial_release_date=date(2019, 1, 2),
                                   price=12000),
                ProductReleaseInfo(initial_release_date=date(2020, 2, 2),
                                   adjusted_release_date=date(2020, 5, 2),
                                   price=12000),
                ProductReleaseInfo(initial_release_date=date(2023, 2, 2),
                                   price=12000),
            ])

        assert ReleaseInfoHelper.compare_infos(
            release_infos, p_m.release_infos) == ReleaseInfosStatus.SAME