def test_get_filter_kwargs_ip(self): self.assertEqual( dict( get_client_parameters(self.username, self.ip_address, self.user_agent)), {"ip_address": self.ip_address}, )
def test_get_filter_kwargs_user(self): self.assertEqual( get_client_parameters(self.username, self.ip_address, self.user_agent), [{ "username": self.username }], )
def filter_user_attempts(request: AxesHttpRequest, credentials: dict = None) -> QuerySet: """ Return a queryset of AccessAttempts that match the given request and credentials. """ username = get_client_username(request, credentials) filter_kwargs = get_client_parameters(username, request.axes_ip_address, request.axes_user_agent) return AccessAttempt.objects.filter(**filter_kwargs)
def test_get_filter_kwargs_ip_and_agent(self): self.assertEqual( get_client_parameters(self.username, self.ip_address, self.user_agent), [{ "ip_address": self.ip_address }, { "user_agent": self.user_agent }], )
def test_get_filter_kwargs_ip_and_agent(self): self.assertEqual( dict( get_client_parameters(self.username, self.ip_address, self.user_agent)), { 'ip_address': self.ip_address, 'user_agent': self.user_agent }, )
def filter_user_attempts(request, credentials: dict = None) -> QuerySet: """ Return a queryset of AccessAttempts that match the given request and credentials. """ username = get_client_username(request, credentials) filter_kwargs = get_client_parameters(username, request.axes_ip_address, request.axes_user_agent) return AccessAttempt.objects.filter(**filter_kwargs)
def filter_user_attempts(request, credentials: dict = None) -> List[QuerySet]: """ Return a list querysets of AccessAttempts that match the given request and credentials. """ username = get_client_username(request, credentials) filter_kwargs_list = get_client_parameters(username, request.axes_ip_address, request.axes_user_agent) attempts_list = [ AccessAttempt.objects.filter(**filter_kwargs) for filter_kwargs in filter_kwargs_list ] return attempts_list
def test_get_filter_kwargs_user_ip_agent(self): self.assertEqual( dict(get_client_parameters(self.username, self.ip_address, self.user_agent)), {'username': self.username, 'ip_address': self.ip_address, 'user_agent': self.user_agent}, )