Exemplo n.º 1
0
    def setUp(self):
        super(ApplicationViewTest, self).setUp()

        class TestFactory(object):
            def create_controller(self, view):
                return Mock(spec=AbstractController)

        self.appview = ApplicationView(TestFactory())
        self.controller = self.appview.controller
Exemplo n.º 2
0
    def setUp(self):
        WxWidgetTestCase.setUp(self)

        parser = AstromParser()
        context = LocalDirectoryWorkingContext(
            self.get_abs_path("data/controller_testdir"))
        progress_manager = LocalProgressManager(context)
        workunit_provider = WorkUnitProvider(tasks.get_suffix(tasks.REALS_TASK),
                                             context, progress_manager,
                                             RealsWorkUnitBuilder(
                                                 parser,
                                                 context,
                                                 context,
                                                 progress_manager))

        image_manager = Mock(spec=ImageManager)

        self.model = ValidationModel(workunit_provider, image_manager, None)
        self.model.start_work()

        self.model.get_writer = Mock(return_value=Mock(spec=mpc.MPCWriter))

        # We don't actually have any images loaded, so mock this out
        source_cutout = Mock(spec=SourceCutout)
        source_cutout.pixel_x = 11
        source_cutout.pixel_y = 50
        self.model.get_current_cutout = Mock(return_value=source_cutout)

        x_cen = 10
        y_cen = 50
        mag = 24.0
        self.model.get_current_source_observed_magnitude = Mock(return_value=(x_cen, y_cen, mag))

        self.model.is_current_source_adjusted = Mock(return_value=False)
        self.model.get_current_fits_header = Mock()

        self.name_generator = Mock(spec=ProvisionalNameGenerator)
        self.name_generator.generate_name.return_value = TEST_PROVISIONAL_NAME

        class TestFactory(object):
            def __init__(self, model, name_generator):
                self.model = model
                self.name_generator = name_generator

            def create_controller(self, view):
                return ProcessRealsController(self.model, view,
                                              self.name_generator)

        self.view = ApplicationView(
            TestFactory(self.model, self.name_generator))
        self.controller = self.view.controller
        self.controller.display_current_image = Mock()
Exemplo n.º 3
0
 def _create_view(self, model, debug=False):
     return ApplicationView(self._create_controller_factory(model),
                            track_mode=True,
                            debug=debug)