def test_by_user_name_none(self, db_session):
        queried_user = User.by_user_name(None, db_session=db_session)

        assert queried_user is None
    def test_by_user_name_existing(self, db_session):
        created_user = add_user(db_session)
        queried_user = User.by_user_name('username', db_session=db_session)

        assert created_user == queried_user
    def test_by_user_name_not_existing(self, db_session):
        add_user(db_session)
        queried_user = User.by_user_name('not_existing_user',
                                         db_session=db_session)

        assert queried_user is None
 def test_delete_user(self, db_session):
     add_user(db_session)
     to_delete = User.by_user_name('username', db_session=db_session)
     db_session.delete(to_delete)
     db_session.commit()
    def test_by_user_name_none(self, db_session):
        queried_user = User.by_user_name(None, db_session=db_session)

        assert queried_user is None
    def test_by_user_name_not_existing(self, db_session):
        add_user(db_session)
        queried_user = User.by_user_name('not_existing_user',
                                         db_session=db_session)

        assert queried_user is None
    def test_by_user_name_existing(self, db_session):
        created_user = add_user(db_session)
        queried_user = User.by_user_name('username', db_session=db_session)

        assert created_user == queried_user
 def test_delete_user(self, db_session):
     add_user(db_session)
     to_delete = User.by_user_name('username', db_session=db_session)
     db_session.delete(to_delete)
     db_session.commit()