Example #1
0
    def test_append_duplicate(self):
        global_state = GlobalState()
        global_state.append_build_packages(self.build_packages)
        global_state.append_build_snaps(self.build_snaps)

        self.assertThat(global_state.get_build_packages(), Equals(self.build_packages))
        self.assertThat(global_state.get_build_snaps(), Equals(self.build_snaps))

        global_state.append_build_packages(self.build_packages)
        global_state.append_build_snaps(self.build_snaps)

        self.assertThat(global_state.get_build_packages(), Equals(self.build_packages))
        self.assertThat(global_state.get_build_snaps(), Equals(self.build_snaps))
Example #2
0
    def test_append_duplicate(self, tmp_work_path, build_packages, build_snaps,
                              required_grade):
        global_state = GlobalState()
        global_state.append_build_packages(build_packages)
        global_state.append_build_snaps(build_snaps)

        assert global_state.get_build_packages() == build_packages
        assert global_state.get_build_snaps() == build_snaps

        global_state.append_build_packages(build_packages)
        global_state.append_build_snaps(build_snaps)

        assert global_state.get_build_packages() == build_packages
        assert global_state.get_build_snaps() == build_snaps
Example #3
0
    def test_save_load_and_append(self, tmp_work_path, build_packages,
                                  build_snaps, required_grade):
        global_state = GlobalState()
        global_state.append_build_packages(build_packages)
        global_state.append_build_snaps(build_snaps)
        global_state.save(filepath="state")

        assert global_state.get_build_packages() == build_packages
        assert global_state.get_build_snaps() == build_snaps

        new_packages = ["new-pkg1", "new-pkg2"]
        new_snaps = ["new-snap1", "new-snap2"]
        global_state = GlobalState.load(filepath="state")
        global_state.append_build_packages(new_packages)
        global_state.append_build_snaps(new_snaps)

        assert global_state.get_build_packages(
        ) == build_packages + new_packages

        assert global_state.get_build_snaps() == build_snaps + new_snaps
Example #4
0
    def test_save_load_and_append(self):
        global_state = GlobalState()
        global_state.append_build_packages(self.build_packages)
        global_state.append_build_snaps(self.build_snaps)
        global_state.save(filepath="state")

        self.assertThat(global_state.get_build_packages(), Equals(self.build_packages))
        self.assertThat(global_state.get_build_snaps(), Equals(self.build_snaps))

        new_packages = ["new-pkg1", "new-pkg2"]
        new_snaps = ["new-snap1", "new-snap2"]
        global_state = GlobalState.load(filepath="state")
        global_state.append_build_packages(new_packages)
        global_state.append_build_snaps(new_snaps)

        self.assertThat(
            global_state.get_build_packages(),
            Equals(self.build_packages + new_packages),
        )
        self.assertThat(
            global_state.get_build_snaps(), Equals(self.build_snaps + new_snaps)
        )