def setUp(self): self.storage = storage_memory.Storage() self.cache = cache_memory.Cache(cache_prefix="", cache_max_size_bytes=1000) self.resource = self.resource_class(request=self.get_request(), context=self.get_context()) self.resource.schema = StrictSchema self.model = self.resource.model self.patch_known_field = mock.patch.object(self.resource, "is_known_field") self.validated = {"body": {}, "header": {}, "querystring": {}} self.resource.request.validated = self.validated
def setUp(self): self.policy = authentication.FxAOAuthAuthenticationPolicy() self.backend = memory_backend.Cache(cache_prefix="tests") self.request = self._build_request() self.profile_data = { "user": "******", "scope": ["profile", "mandatory", "optional"], "client_id": "" }
def setUp(self): self.policy = authentication.FxAOAuthAuthenticationPolicy() self.backend = memory_backend.Cache(cache_prefix="tests", cache_max_size_bytes=float("inf")) self.request = self._build_request() self.profile_data = { "user": "******", "scope": ["profile", "https://identity.mozilla.org/apps/notes"], "client_id": "c73e46074a948932" }
def setUp(self): self.policy = authentication.LDAPBasicAuthAuthenticationPolicy() self.backend = memory_backend.Cache(cache_prefix="tests") self.request = DummyRequest() self.request.registry.cache = self.backend self.request.registry.ldap_cm = mock.MagicMock() settings = DEFAULT_SETTINGS.copy() settings['userid_hmac_secret'] = 'abcdef' settings['ldap.cache_ttl_seconds'] = 0.01 self.request.registry.settings = settings self.request.headers['Authorization'] = ( 'Basic ' + base64.b64encode(b'username:password').decode('utf-8'))
def setUp(self): self.policy = authentication.PortierOAuthAuthenticationPolicy() self.backend = memory_backend.Cache(cache_prefix="", cache_max_size_bytes=5123) self.user_hmac_secret = random_bytes_hex(16) # Setup user self.token = '4128913851c9c4305e43dba2a7e59baa5c2fe2b909c6b63d04668346c4fb1e7b' self.email = '*****@*****.**' encrypted_email = encrypt(self.email, self.token) self.user_key = hmac_digest(self.user_hmac_secret, self.token) print("portier:%s" % self.user_key) self.backend.set("portier:%s" % self.user_key, encrypted_email, ttl=300) self.request = self._build_request()
def setUp(self): self.policy = authentication.FacebookAuthenticationPolicy() self.backend = memory_backend.Cache(cache_prefix="tests", cache_max_size_bytes=float("inf")) self.request = self._build_request() self.profile_data = { "app_id": 138483919580948, "type": "USER", "application": "Social Cafe", "expires_at": 1352419328, "is_valid": True, "issued_at": 1347235328, "metadata": { "sso": "iphone-safari" }, "scopes": ["email", "publish_actions"], "user_id": "33" }
def setUp(self): cache = memory_backend.Cache(cache_prefix="tests", cache_max_size_bytes=float("inf")) self.cache = authentication.TokenVerificationCache(cache, 0.01)
def setUp(self): cache = memory_backend.Cache(cache_prefix="tests") self.cache = authentication.TokenVerificationCache(cache, 0.01)