Example #1
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()
Example #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()
Example #3
0
    def setUp(self):
        WxWidgetTestCase.setUp(self)

        parser = AstromParser()
        directory_manager = DirectoryContext(
            self.get_abs_path("data/controller_testdir"))
        progress_manager = ProgressManager(directory_manager)
        workunit_provider = WorkUnitProvider(tasks.get_suffix(tasks.REALS_TASK),
                                             directory_manager, progress_manager,
                                             RealsWorkUnitBuilder(parser, progress_manager))

        download_manager = Mock(spec=AsynchronousImageDownloadManager)

        self.model = UIModel(workunit_provider, progress_manager, download_manager)

        self.name_generator = Mock()
        self.controller = ProcessRealsController(self.model, self.name_generator)
Example #4
0
 def tearDown(self):
     WxWidgetTestCase.tearDown(self)
     DirectoryCleaningTestCase.tearDown(self)