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

What to test exactly #9

Open
justinmoon opened this issue Aug 29, 2019 · 2 comments
Open

What to test exactly #9

justinmoon opened this issue Aug 29, 2019 · 2 comments

Comments

@justinmoon
Copy link
Owner

This thing needs tests:

  • Watch-only wallet creation and address generation
  • PSBT lifecycle
  • ...
@k9ert
Copy link
Contributor

k9ert commented Sep 1, 2019

In the current state the application is not very testable. I tried to create tests but creating the app-for testing purposes is quite difficult, mainly because of:
https://github.com/justinmoon/junction/blob/master/ui.py#L11

Although Unittests of Classes and helper-utils might even be possible, in practice most python-files use dependencies from flask which results in "outside app-context issues" when testing.
Also, if you you don't have any tests, it's usually better to start end2end-testing rather then unit-testing.

Therefore i'd like to get this project in a testable shape rather early on. I'm not sure whether you're biased to anything or have strong opinions on how to test that stuff. Here is a rough idea on what worked for me on a midsize flask-project with 90+ tests and roughly 80% test-coverage:

def test_dashboard(client, fresh_user_with_purchases):
    #pylint: disable=unused-argument
    ''' tests the dashboard '''
    from someapp.models import db
    db.session.add(fresh_user_with_purchases)
    result = login(client, fresh_user_with_purchases.email, 'bla')
    assert b'Logged in successfully.' in result.data
    print_messages(result.data)
    result = client.get('/dashboard')
    assert b'some other text' in result.data

Would such an approach work for you? I'm happy to work on that but it will include some heavy changes in filestructures and the way the app is started/tested.

@justinmoon
Copy link
Owner Author

I want to start by testing junction.py. I'm mostly concerned with:

  • Wallet file IO
  • Watch-only wallet creation / export
  • Address index logic
  • Add / remove signer logic

I've got a testing branch where I'm starting to do this

The UI is currently being rewritten (typescript branch) so it's probably premature to test it ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants