Ejemplo n.º 1
0
 def test_singleton(self):
     """
     Test to make sure the MilestonesService is a singleton.
     """
     service1 = MilestonesService()
     service2 = MilestonesService()
     self.assertIs(service1, service2)
Ejemplo n.º 2
0
def get_service():
    """
    Returns MilestonesService instance if feature flag enabled;
    else returns None.

    Note: MilestonesService only has access to the functions
    explicitly requested in the MilestonesServices class
    """
    if not ENABLE_MILESTONES_APP.is_enabled():
        return None
    return MilestonesService()
def get_service():
    """
    Returns MilestonesService instance if feature flag enabled;
    else returns None.

    Note: MilestonesService only has access to the functions
    explicitly requested in the MilestonesServices class
    """
    if not settings.FEATURES.get('MILESTONES_APP', False):
        return None
    return MilestonesService()
Ejemplo n.º 4
0
    def test_basic(self):
        """
        See if the MilestonesService exposes the expected methods
        """

        service = MilestonesService()

        for attr_name in dir(milestones_api):
            attr = getattr(milestones_api, attr_name, None)
            if isinstance(attr, types.FunctionType) and not attr_name.startswith('_'):
                if attr_name in MilestonesService.REQUESTED_FUNCTIONS:
                    self.assertTrue(hasattr(service, attr_name))
                else:
                    self.assertFalse(hasattr(service, attr_name))