jupyterhub / jupyterhub/nativeauthenticator

TLJH Signup and login customizations not working

Open
#98 10 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Python
Stars
81
Forks
68
PR merge metrics
No merged PRs in 30d

Description

Having few issues with login and signup custom pages not displaying after enabling Native Authentication - jupyterhub/nativeauthenticator#69 suggestions do not seem to work for me and having trouble figuring out what the issues are.

Ran pytest ad getting 2 error and 2 warning messages. Also not sure if these errors are related to the issue or not.

```
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 =

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 =

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 =

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 ================================================================================
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.