コード例 #1
0
ファイル: tests.py プロジェクト: hotdogee/django-blast
    def test_cooling_off(self):
        """Tests if the cooling time allows a user to login
        """
        self.test_failure_limit_once()

        # Wait for the cooling off period
        time.sleep(COOLOFF_TIME.total_seconds())

        # It should be possible to login again, make sure it is.
        self.test_valid_login()
コード例 #2
0
ファイル: tests.py プロジェクト: toabi/django-axes
    def test_cooling_off(self):
        """Tests if the cooling time allows a user to login
        """
        self.test_failure_limit_once()

        # Wait for the cooling off period
        time.sleep(COOLOFF_TIME.total_seconds())

        # It should be possible to login again, make sure it is.
        self.test_valid_login()
コード例 #3
0
ファイル: tests.py プロジェクト: JorisE/django-axes
    def test_cooling_off(self, username=None):
        if username:
            valid_username = username
        else:
            valid_username = self._random_username(existing_username=True)

        # Test unsuccessful login and stop just before lockout happens
        for i in range(0, FAILURE_LIMIT):
            response = self._unsuccessful_login(valid_username)

            # Check if we are in the same login page
            self.assertIn(LOGIN_FORM_KEY, response.content)

        # Lock out the user
        response = self._unsuccessful_login(valid_username)
        self.assertIn(self.LOCKED_MESSAGE, response.content)

        # Wait for the cooling off period
        time.sleep(COOLOFF_TIME.total_seconds())

        # It should be possible to login again, make sure it is.
        response = self._successful_login(valid_username, valid_username)
        self.assertNotIn(self.LOCKED_MESSAGE, response.content)
コード例 #4
0
    def test_cooling_off(self, username=None):
        if username:
            valid_username = username
        else:
            valid_username = self._random_username(existing_username=True)

        # Test unsuccessful login and stop just before lockout happens
        for i in range(0, FAILURE_LIMIT):
            response = self._unsuccessful_login(valid_username)

            # Check if we are in the same login page
            self.assertIn(LOGIN_FORM_KEY, response.content)

        # Lock out the user
        response = self._unsuccessful_login(valid_username)
        self.assertIn(self.LOCKED_MESSAGE, response.content)

        # Wait for the cooling off period
        time.sleep(COOLOFF_TIME.total_seconds())

        # It should be possible to login again, make sure it is.
        response = self._successful_login(valid_username, valid_username)
        self.assertNotIn(self.LOCKED_MESSAGE, response.content)