deltachat / mailadm

mail account administration tool for temporary and other account creation/modification
https://mailadm.readthedocs.io/
Mozilla Public License 2.0
14 stars 1 forks source link

users which are created by the web API are not added to the DB anymore #92

Closed missytake closed 1 year ago

missytake commented 1 year ago
pytest tests/test_web.py::test_user_in_db
============================================================================================================ test session starts ============================================================================================================
platform linux -- Python 3.10.6, pytest-7.2.0, pluggy-1.0.0
Deltachat core=v1.101.0 sqlite=3.37.2 journal_mode=wal
rootdir: /home/user/git/mailadm
plugins: timeout-2.1.0, deltachat-1.101.0, xdist-3.0.2
collected 1 item                                                                                                                                                                                                                            

tests/test_web.py F                                                                                                                                                                                                                   [100%]

================================================================================================================= FAILURES ==================================================================================================================
______________________________________________________________________________________________________________ test_user_in_db ______________________________________________________________________________________________________________

db = <mailadm.db.DB object at 0x7fae26071930>, mailcow = <mailadm.mailcow.MailcowConnection object at 0x7fae26072500>

    def test_user_in_db(db, mailcow):
        with db.write_transaction() as conn:
            token = conn.add_token("pytest:web", expiry="1w", token="1w_7wDioPeeXyZx96v", prefix="")
        app = create_app_from_db_path(db.path)
        app.debug = True
        app = app.test_client()

        r = app.post('/?t=' + token.token)
        assert r.status_code == 200
        assert r.json["password"]
        addr = r.json["email"]

        assert mailcow.get_user(addr)
        with db.read_connection() as conn:
>           assert conn.get_user_by_addr(addr)

tests/test_web.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <mailadm.conn.Connection object at 0x7fae26073ee0>, addr = 'jsnfk@x.testrun.org'

    def get_user_by_addr(self, addr):
        q = UserInfo._select_user_columns + "WHERE addr = ?"
        args = self._sqlconn.execute(q, (addr, )).fetchone()
>       return UserInfo(*args)
E       TypeError: mailadm.conn.UserInfo() argument after * must be an iterable, not NoneType

src/mailadm/conn.py:226: TypeError
----------------------------------------------------------------------------------------------------------- Captured stdout setup -----------------------------------------------------------------------------------------------------------
DB: Creating tables /tmp/pytest-of-user/pytest-107/test_user_in_db0/base/mailadm.db
----------------------------------------------------------------------------------------------------------- Captured stdout call ------------------------------------------------------------------------------------------------------------
added token 'pytest:web'
added addr 'jsnfk@x.testrun.org' with token 'pytest:web'
========================================================================================================== short test summary info ==========================================================================================================
FAILED tests/test_web.py::test_user_in_db - TypeError: mailadm.conn.UserInfo() argument after * must be an iterable, not NoneType
============================================================================================================= 1 failed in 1.64s =============================================================================================================