Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
missytake opened this issue Jan 7, 2023 · 0 comments · Fixed by #93
Closed

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

missytake opened this issue Jan 7, 2023 · 0 comments · Fixed by #93
Labels
bug Something isn't working

Comments

@missytake
Copy link
Contributor

  • Operating System (Linux/Mac/Windows/iOS/Android): Linux
  • Expected behavior: when an email account is created via the web route, it gets added to the database and pruned later when it expires.
  • Actual behavior: the account is not added to the database, so it never gets deleted. If you check mailadm list-users, it appears only with a [created in mailcow] addition, not with the token which actually created it.
  • Steps to reproduce the problem:
  • Logs:
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 =============================================================================================================
@missytake missytake mentioned this issue Jan 7, 2023
@missytake missytake added the bug Something isn't working label Jan 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant