jupyterhub / the-littlest-jupyterhub

Simple JupyterHub distribution for 1-100 users on a single server
https://tljh.jupyter.org
BSD 3-Clause "New" or "Revised" License
1.04k stars 340 forks source link

Login page not customized #512

Closed t3chbg closed 3 years ago

t3chbg commented 4 years ago

Having few issues with login and signup pages - customization on page https://github.com/jupyterhub/nativeauthenticator/pull/69 is not working for me and having trouble figuring out where the issue lies.

Compared py files both on my server and git project found no differences. Did run pytest ad getting 2 error and 2 warning messages.

platform linux -- Python 3.7.6, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
rootdir: /opt/tljh/nativeauthenticator
plugins: asyncio-0.10.0
collected 27 items                                                                                                                                                                                        

nativeauthenticator/tests/test_authenticator.py ...................FF..                                                                                                                             [ 85%]
nativeauthenticator/tests/test_orm.py ....                                                                                                                                                          [100%]

================================================================================================ FAILURES =================================================================================================
_____________________________________________________________________________ test_import_from_firstuse_dont_delete_db_after ______________________________________________________________________________

tmpcwd = None, app = <jupyterhub.tests.mocking.MockHub object at 0x7fa01d7ce490>

    async def test_import_from_firstuse_dont_delete_db_after(tmpcwd, app):
        with dbm.open('passwords.dbm', 'c', 0o600) as db:
            db['user1'] = 'password'

        auth = NativeAuthenticator(db=app.db)
        auth.add_data_from_firstuse()

        files = os.listdir()
        assert UserInfo.find(app.db, 'user1')
>       assert ('passwords.dbm' in files) or ('passwords.dbm.db' in files)
E       AssertionError: assert ('passwords.dbm' in ['passwords.dbm.dat', 'passwords.dbm.dir', 'jupyterhub.sqlite', 'passwords.dbm.bak'] or 'passwords.dbm.db' in ['passwords.dbm.dat', 'passwords.dbm.dir', 'jupyterhub.sqlite', 'passwords.dbm.bak'])

/opt/tljh/nativeauthenticator/nativeauthenticator/tests/test_authenticator.py:182: AssertionError
------------------------------------------------------------------------------------------ Captured stderr setup ------------------------------------------------------------------------------------------
[I 2020-02-17 18:30:31.724 alembic.runtime.migration migration:154] Context impl SQLiteImpl.
[I 2020-02-17 18:30:31.725 alembic.runtime.migration migration:161] Will assume non-transactional DDL.
[I 2020-02-17 18:30:31.742 alembic.runtime.migration migration:513] Running stamp_revision  -> 4dc2d5a8c53c
________________________________________________________________________________ test_import_from_firstuse_delete_db_after ________________________________________________________________________________

tmpcwd = None, app = <jupyterhub.tests.mocking.MockHub object at 0x7fa01d8dc910>

    async def test_import_from_firstuse_delete_db_after(tmpcwd, app):
        with dbm.open('passwords.dbm', 'c', 0o600) as db:
            db['user1'] = 'password'

        auth = NativeAuthenticator(db=app.db)
        auth.delete_firstuse_db_after_import = True

>       auth.add_data_from_firstuse()

/opt/tljh/nativeauthenticator/nativeauthenticator/tests/test_authenticator.py:192: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/tljh/nativeauthenticator/nativeauthenticator/nativeauthenticator.py:246: in add_data_from_firstuse
    self.delete_dbm_db()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <nativeauthenticator.nativeauthenticator.NativeAuthenticator object at 0x7fa01d8dca90>

    def delete_dbm_db(self):
        db_path = Path(self.firstuse_db_path)
        db_dir = db_path.cwd()
        db_name = db_path.name
        db_complete_path = str(db_path.absolute())

        # necessary for BSD implementation of dbm lib
        if db_name + '.db' in os.listdir(db_dir):
            os.remove(db_complete_path + '.db')
        else:
>           os.remove(db_complete_path)
E           FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pytest-of-root/pytest-3/test_import_from_firstuse_dele0/passwords.dbm'

/opt/tljh/nativeauthenticator/nativeauthenticator/nativeauthenticator.py:232: FileNotFoundError
------------------------------------------------------------------------------------------ Captured stderr setup ------------------------------------------------------------------------------------------
[I 2020-02-17 18:30:32.429 alembic.runtime.migration migration:154] Context impl SQLiteImpl.
[I 2020-02-17 18:30:32.429 alembic.runtime.migration migration:161] Will assume non-transactional DDL.
[I 2020-02-17 18:30:32.446 alembic.runtime.migration migration:513] Running stamp_revision  -> 4dc2d5a8c53c
============================================================================================ warnings summary =============================================================================================
nativeauthenticator/nativeauthenticator.py:23
  /opt/tljh/nativeauthenticator/nativeauthenticator/nativeauthenticator.py:23: DeprecationWarning: metadata {'default': False} was set from the constructor. With traitlets 4.1, metadata should be set using the .tag() method, e.g., Int().tag(key1='value1', key2='value2')
    help=("Creates a verification of password strength "

/opt/tljh/user/lib/python3.7/site-packages/notebook/notebookapp.py:47
  /opt/tljh/user/lib/python3.7/site-packages/notebook/notebookapp.py:47: DeprecationWarning: zmq.eventloop.ioloop is deprecated in pyzmq 17. pyzmq now works with default tornado and asyncio eventloops.
    ioloop.install()

-- Docs: https://docs.pytest.org/en/latest/warnings.html
================================================================================ 2 failed, 25 passed, 2 warnings in 29.47s ================================================================================
jupyter-brendan.gilbert@svrltljh01:/opt/tljh/nativeauthenticator$ 
consideRatio commented 3 years ago

I don't know how to help you with this, and its related to the nativeauthenticator package. I've linked to this issue from #434.