예제 #1
0
    def test_generate_idam_status_geoaxis_503(self, mock_get):
        """Tests the _generate_idam_status method with geoaxis enabled and an unreachable host"""

        idam = dependency_mgr._generate_idam_status()
        detail = {}
        detail['geoaxis_host'] = u'geoaxis.gxaccess.com'
        detail['geoaxis_enabled'] = True
        detail['backends'] = [
            'django.contrib.auth.backends.ModelBackend',
            'django_geoaxis.backends.geoaxis.GeoAxisOAuth2'
        ]
        detail[
            'geoaxis_authorization_url'] = django_geoaxis.backends.geoaxis.GeoAxisOAuth2.AUTHORIZATION_URL
        detail['scale_vhost'] = 'host-offline'
        msg = 'Error accessing Geoaxis login url https://host-offline/social-auth/login/geoaxis/?=: HTTP Service Unavailable: None'
        detail['msg'] = msg
        self.assertDictEqual(
            idam, {
                'OK': False,
                'detail': detail,
                'errors': [{
                    u'GEOAXIS_ERROR': msg
                }],
                'warnings': []
            })
예제 #2
0
    def test_generate_idam_status_no_geoaxis(self):
        """Tests the _generate_idam_status method with geoaxis disabled"""

        idam = dependency_mgr._generate_idam_status()
        self.assertDictEqual(
            idam, {
                'OK': True,
                'detail': {
                    'geoaxis_enabled': False,
                    'msg': 'GEOAxIS is not enabled'
                },
                'errors': [],
                'warnings': []
            })
예제 #3
0
    def test_generate_idam_status_geoaxis_success(self, mock_get):
        """Tests the _generate_idam_status method with geoaxis enabled and a successful response"""

        idam = dependency_mgr._generate_idam_status()
        detail = {}
        detail['geoaxis_host'] = u'geoaxis.gxaccess.com'
        detail['geoaxis_enabled'] = True
        detail['backends'] = [
            'django.contrib.auth.backends.ModelBackend',
            'django_geoaxis.backends.geoaxis.GeoAxisOAuth2'
        ]
        detail[
            'geoaxis_authorization_url'] = django_geoaxis.backends.geoaxis.GeoAxisOAuth2.AUTHORIZATION_URL
        detail['scale_vhost'] = 'scale.io'
        detail['msg'] = 'GEOAxIS is enabled'
        self.assertDictEqual(idam, {
            'OK': True,
            'detail': detail,
            'errors': [],
            'warnings': []
        })