old_contents: """User Model Tests."""
  import unittest
  from .. import create_app, db
  from ..database import User
  
  
  class UserModelTestCase(unittest.TestCase):
      """User model tests."""
  
      def setUp(self):
          """Set up tests."""
          self.app = create_app('testing')
          self.app_context = self.app.app_context()
          self.app_context.push()
          db.create_all()
  
      def tearDown(self):
          """Clean up after tests."""
          db.session.remove()
          db.drop_all()
          self.app_context.pop()
  
      def test_password_setter(self):
          """Test password is hased and set."""
          u = User(password='cat')
          self.assertTrue(u.password_hash is not None)
  
      def test_no_password_getter(self):
          """Test can not get password."""
          u = User(password='cat')
          with self.assertRaises(AttributeError):
              u.password
  
      def test_password_verification(self):
          """Test password verification."""
          u = User(password='cat')
          self.assertTrue(u.verify_password('cat'))
          self.assertFalse(u.verify_password('dog'))
  
      def test_password_salts_are_random(self):
          """Test password salts are random."""
          u = User(password='cat')
          u2 = User(password='cat')
          self.assertTrue(u.password_hash != u2.password_hash)
  
new_contents: """User Model Tests."""
  import unittest
  from .. import create_app, db
  from ..database import User
  
  
  class UserModelTestCase(unittest.TestCase):
      """User model tests."""
  
      def setUp(self):
          """Set up tests."""
          self.app = create_app('testing')
          self.app_context = self.app.app_context()
          self.app_context.push()
          db.create_all()
  
      def tearDown(self):
          """Clean up after tests."""
          db.session.remove()
          db.drop_all()
          self.app_context.pop()
  
      def test_password_setter(self):
          """Test password is hashed and set."""
          u = User(password='cat')
          self.assertTrue(u.password_hash is not None)
  
      def test_no_password_getter(self):
          """Test can not get password."""
          u = User(password='cat')
          with self.assertRaises(AttributeError):
              u.password
  
      def test_password_verification(self):
          """Test password verification."""
          u = User(password='cat')
          self.assertTrue(u.verify_password('cat'))
          self.assertFalse(u.verify_password('dog'))
  
      def test_password_salts_are_random(self):
          """Test password salts are random."""
          u = User(password='cat')
          u2 = User(password='cat')
          self.assertTrue(u.password_hash != u2.password_hash)
  
subject: Fix typo