Example #1
0
    def test_get_fulfillment_modules(self):
        """
        Verify the function retrieves the modules specified in settings.
        An error should be logged for modules that cannot be loaded.
        """
        logger_name = 'ecommerce.extensions.fulfillment.api'

        with LogCapture(logger_name) as l:
            actual = get_fulfillment_modules()

            # Only FakeFulfillmentModule should be loaded since it is the only real class.
            self.assertEqual(actual, [FakeFulfillmentModule])

            # An error should be logged for NotARealModule since it cannot be loaded.
            l.check((logger_name, 'ERROR',
                     'Could not load module at [ecommerce.extensions.fulfillment.tests.modules.NotARealModule]'))
Example #2
0
    def test_get_fulfillment_modules(self):
        """
        Verify the function retrieves the modules specified in settings.
        An error should be logged for modules that cannot be loaded.
        """
        logger_name = 'ecommerce.extensions.fulfillment.api'

        with LogCapture(logger_name) as logger:
            actual = get_fulfillment_modules()

            # Only FakeFulfillmentModule should be loaded since it is the only real class.
            self.assertEqual(actual, [FakeFulfillmentModule])

            # An error should be logged for NotARealModule since it cannot be loaded.
            logger.check((
                logger_name, 'ERROR',
                'Could not load module at [ecommerce.extensions.fulfillment.tests.modules.NotARealModule]'
            ))