Exemplo n.º 1
0
  def test_validate_strong_password(self):
    """Tests if password validation works correctly."""
    def assert_error(password):
      try:
        auth.validate_strong_password(password)
        self.fail("Expected a ValidationError")
      except ValidationError:
        pass  # expected

    assert_error(None)
    assert_error("")
    assert_error("foo")
    assert_error("123456789")
    assert_error("1234abcd")
    assert_error("1234ABCD")

    auth.validate_strong_password("1234ABcd")
Exemplo n.º 2
0
    def test_validate_strong_password(self):
        """Tests if password validation works correctly."""

        def assert_error(password):
            try:
                auth.validate_strong_password(password)
                self.fail("Expected a ValidationError")
            except ValidationError:
                pass  # expected

        assert_error(None)
        assert_error("")
        assert_error("foo")
        assert_error("123456789")
        assert_error("1234abcd")
        assert_error("1234ABCD")

        auth.validate_strong_password("1234ABcd")
Exemplo n.º 3
0
 def assert_error(password):
     try:
         auth.validate_strong_password(password)
         self.fail("Expected a ValidationError")
     except ValidationError:
         pass  # expected
Exemplo n.º 4
0
 def clean_password1(self):
     password = self.cleaned_data["password1"]
     return auth.validate_strong_password(password)
Exemplo n.º 5
0
 def clean_password1(self):
   password = self.cleaned_data["password1"]
   return auth.validate_strong_password(password)
Exemplo n.º 6
0
 def assert_error(password):
   try:
     auth.validate_strong_password(password)
     self.fail("Expected a ValidationError")
   except ValidationError:
     pass  # expected