Пример #1
0
    def test_database_config(self):
        c = config.get_config()

        self.assertIsInstance(c, SafeConfigParser)

        self.assertTrue(c.has_section('database'))
        self.assertTrue(c.has_option('database', 'url'))
Пример #2
0
    def test_pdf_to_svg(self):
        if not exists(get_config().get('utilities', 'pdftocairo')):
            self.skipTest('pdftocairo not available')

        page = pdf_to_svg(example_pdf, page=1)

        self.assertEqual(determine_figure_type(page), FigureType.SVG)
Пример #3
0
    def test_pdf_to_png_cairo(self):
        if not exists(get_config().get('utilities', 'pdftocairo')):
            self.skipTest('pdftocairo not available')

        # Repeat using "pdftocairo".
        pages = pdf_to_png(example_pdf, renderer='pdftocairo')
        self.assertEqual(len(pages), 1)
        self.assertEqual(determine_figure_type(pages[0]), FigureType.PNG)
Пример #4
0
    def test_pdf_to_png_ghostscript(self):
        if not exists(get_config().get('utilities', 'ghostscript')):
            self.skipTest('Ghostscript not available')

        # Render using "ghostscript".
        pages = pdf_to_png(example_pdf, renderer='ghostscript')
        self.assertEqual(len(pages), 1)
        self.assertEqual(determine_figure_type(pages[0]), FigureType.PNG)
Пример #5
0
    def test_ps_to_png(self):
        if not exists(get_config().get('utilities', 'ghostscript')):
            self.skipTest('Ghostscript not available')

        pages = ps_to_png(example_eps)
        self.assertEqual(len(pages), 1)

        self.assertEqual(determine_figure_type(pages[0]), FigureType.PNG)
Пример #6
0
    def test_home_var(self):
        """
        Test that we get an error if the file doesn't exists.

        Also checks that the environment variable is being read.
        """

        os.environ['HEDWIG_DIR'] = '/HORSEFEATHERS'
        with self.assertRaises(Error):
            c = config.get_config()
Пример #7
0
    def setUp(self):
        DummyConfigTestCase.setUp(self)

        self.config = get_config()
        self.db = get_dummy_database(facility_spec=self.facility_spec,
                                     randomize_ids=False)
        auth._rounds = 10
        auth.password_hash_delay = 0

        app_info = create_web_app(db=self.db, facility_spec=self.facility_spec,
                                  _test_return_extra=True)

        self.app = app_info['app']
        self.app.config['TESTING'] = True

        self.facilities = app_info['facilities']

        self.client = self.app.test_client()
Пример #8
0
    def setUp(self):
        DummyConfigTestCase.setUp(self)

        self.config = get_config()
        self.db = get_dummy_database(facility_spec=self.facility_spec,
                                     randomize_ids=False)
        auth._rounds = 10
        auth.password_hash_delay = 0

        app_info = create_web_app(db=self.db,
                                  facility_spec=self.facility_spec,
                                  _test_return_extra=True)

        self.app = app_info['app']
        self.app.config['TESTING'] = True

        self.facilities = app_info['facilities']

        self.client = self.app.test_client()
Пример #9
0
def run_migrations_offline():
    """Run migrations in 'offline' mode.

    This configures the context with just a URL
    and not an Engine, though an Engine is acceptable
    here as well.  By skipping the Engine creation
    we don't even need a DBAPI to be available.

    Calls to context.execute() here emit the given string to the
    script output.

    """

    context.configure(url=get_config().get('database', 'url'),
                      target_metadata=target_metadata,
                      literal_binds=True,
                      include_object=include_object)

    with context.begin_transaction():
        context.run_migrations()
Пример #10
0
def run_migrations_offline():
    """Run migrations in 'offline' mode.

    This configures the context with just a URL
    and not an Engine, though an Engine is acceptable
    here as well.  By skipping the Engine creation
    we don't even need a DBAPI to be available.

    Calls to context.execute() here emit the given string to the
    script output.

    """

    context.configure(
        url=get_config().get('database', 'url'),
        target_metadata=target_metadata,
        literal_binds=True,
        include_object=include_object
    )

    with context.begin_transaction():
        context.run_migrations()