Skip to content

Commit

Permalink
Merge pull request Tribler#1066 from qstokkink/add_missing_cid_exception
Browse files Browse the repository at this point in the history
Updated error when community_id is missing
Add test for token balance for better coverage
  • Loading branch information
kozlovsky committed Dec 20, 2021
1 parent 3fc4d68 commit 00b1c1a
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 0 deletions.
Empty file.
104 changes: 104 additions & 0 deletions src/tribler-gui/tribler_gui/tests/gui_test_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Test data for token balance history

negative_token_balance_history = [
{'timestamp': 1639989682705, 'balance': -4242445126},
{'timestamp': 1639989682715, 'balance': -4242942932},
{'timestamp': 1639989682725, 'balance': -4243010528},
{'timestamp': 1639989836725, 'balance': -4243010528},
{'timestamp': 1639989836756, 'balance': -4243010528},
{'timestamp': 1639989837713, 'balance': -4242920753},
{'timestamp': 1639989838040, 'balance': -4242920753},
{'timestamp': 1639989838050, 'balance': -4242920753},
{'timestamp': 1639989865600, 'balance': -4243183609},
{'timestamp': 1639989865600, 'balance': -4243364423},
{'timestamp': 1639989865615, 'balance': -4243542847},
{'timestamp': 1639989865615, 'balance': -4243706616},
{'timestamp': 1639989865631, 'balance': -4243826841},
{'timestamp': 1639989865647, 'balance': -4243891015},
{'timestamp': 1639989904528, 'balance': -4243891015},
{'timestamp': 1639989921434, 'balance': -4243891015},
{'timestamp': 1639989921450, 'balance': -4243891015},
{'timestamp': 1639989921997, 'balance': -4243891015},
{'timestamp': 1639989921997, 'balance': -4243891015},
{'timestamp': 1639989931318, 'balance': -4244475952},
{'timestamp': 1639989931334, 'balance': -4244704214},
{'timestamp': 1639989931334, 'balance': -4244732128},
{'timestamp': 1639989931350, 'balance': -4244758963},
{'timestamp': 1639989931365, 'balance': -4244781725},
{'timestamp': 1639989931365, 'balance': -4244806208},
{'timestamp': 1639990014979, 'balance': -4245061842},
{'timestamp': 1639990014995, 'balance': -4245120697},
{'timestamp': 1639990014995, 'balance': -4245168539},
{'timestamp': 1639990015010, 'balance': -4245216358},
{'timestamp': 1639990015010, 'balance': -4245221001},
{'timestamp': 1639990015026, 'balance': -4245225659},
{'timestamp': 1639990193728, 'balance': -4245241816},
{'timestamp': 1639990250821, 'balance': -4245243295},
{'timestamp': 1639990448300, 'balance': -4245243295},
{'timestamp': 1639990454609, 'balance': -4245243295},
{'timestamp': 1639991174571, 'balance': -4245852308},
{'timestamp': 1639991174587, 'balance': -4245986649},
{'timestamp': 1639991174587, 'balance': -4246441060},
{'timestamp': 1639991174602, 'balance': -4248106527},
{'timestamp': 1639991174602, 'balance': -4249141793},
{'timestamp': 1639991174618, 'balance': -4249402255},
{'timestamp': 1639991279504, 'balance': -4249454759},
{'timestamp': 1639991279519, 'balance': -4249569078},
{'timestamp': 1639991279519, 'balance': -4249804508},
{'timestamp': 1639991279535, 'balance': -4249919744},
{'timestamp': 1639991279582, 'balance': -4249927169},
{'timestamp': 1639991279598, 'balance': -4249939590},
{'timestamp': 1639991355956, 'balance': -4250162322},
{'timestamp': 1639991355971, 'balance': -4250284312},
{'timestamp': 1639991355971, 'balance': -4250512181},
{'timestamp': 1639991355987, 'balance': -4250567205},
{'timestamp': 1639991355987, 'balance': -4250726076},
{'timestamp': 1639991356003, 'balance': -4251008765},
{'timestamp': 1639991356003, 'balance': -4251491838},
{'timestamp': 1639991484789, 'balance': -4251490530},
{'timestamp': 1639991484789, 'balance': -4251491838},
{'timestamp': 1639991491322, 'balance': -4251493162},
{'timestamp': 1639991491338, 'balance': -4251497771},
{'timestamp': 1639991491338, 'balance': -4251498931},
{'timestamp': 1639991491353, 'balance': -4251501656},
{'timestamp': 1639991491369, 'balance': -4251502083},
{'timestamp': 1639991491385, 'balance': -4251502510},
{'timestamp': 1639991901542, 'balance': -4251500986},
{'timestamp': 1639991948147, 'balance': -4253313336},
{'timestamp': 1639991948162, 'balance': -4253442797},
{'timestamp': 1639991948162, 'balance': -4253643279},
{'timestamp': 1639991948162, 'balance': -4257892944},
{'timestamp': 1639991948178, 'balance': -4260661821},
{'timestamp': 1639991948188, 'balance': -4261099251},
{'timestamp': 1639992013196, 'balance': -4261261311},
{'timestamp': 1639992013206, 'balance': -4261438136},
{'timestamp': 1639992013216, 'balance': -4261805891},
{'timestamp': 1639992013216, 'balance': -4262175431},
{'timestamp': 1639992013236, 'balance': -4262246474},
{'timestamp': 1639992013236, 'balance': -4262542764},
{'timestamp': 1639992111113, 'balance': -4262590904},
{'timestamp': 1639992111128, 'balance': -4262657779},
{'timestamp': 1639992111144, 'balance': -4262720033},
{'timestamp': 1639992111144, 'balance': -4262831837},
{'timestamp': 1639992111160, 'balance': -4262832264},
{'timestamp': 1639992111160, 'balance': -4262832691},
{'timestamp': 1639992534358, 'balance': -4262824219},
{'timestamp': 1639992597448, 'balance': -4262825830},
{'timestamp': 1639992740444, 'balance': -4262820880},
{'timestamp': 1639992740447, 'balance': -4262822860},
{'timestamp': 1639992740728, 'balance': -4262822860},
{'timestamp': 1639992863178, 'balance': -4457312394},
{'timestamp': 1639992863194, 'balance': -4526475834},
{'timestamp': 1639992863213, 'balance': -4640392288},
{'timestamp': 1639992863222, 'balance': -4806582573},
{'timestamp': 1639992863232, 'balance': -4929355104},
{'timestamp': 1639992863490, 'balance': -4929355104},
{'timestamp': 1639992863513, 'balance': -4815438650},
{'timestamp': 1639992863517, 'balance': -4815438650},
{'timestamp': 1639992863604, 'balance': -4929355104},
{'timestamp': 1639992866229, 'balance': -4929355104},
{'timestamp': 1639992868239, 'balance': -5008495201},
{'timestamp': 1639992868395, 'balance': -5008495201},
{'timestamp': 1639992883269, 'balance': -5008495201},
{'timestamp': 1639992883456, 'balance': -5008495201},
]
10 changes: 10 additions & 0 deletions src/tribler-gui/tribler_gui/tests/test_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import tribler_gui
from tribler_gui.dialogs.feedbackdialog import FeedbackDialog
from tribler_gui.dialogs.new_channel_dialog import NewChannelDialog
from tribler_gui.tests.gui_test_data import negative_token_balance_history
from tribler_gui.tribler_app import TriblerApplication
from tribler_gui.tribler_window import TriblerWindow
from tribler_gui.utilities import connect
Expand Down Expand Up @@ -564,6 +565,15 @@ def test_trust_page(window):
screenshot(window, name="trust_page_values")


@pytest.mark.guitest
def test_big_negative_token_balance(window):
QTest.mouseClick(window.token_balance_widget, Qt.LeftButton)
wait_for_variable(window, "trust_page.history")
window.trust_page.history = negative_token_balance_history
window.trust_page.plot_absolute_values()
screenshot(window, name="big_negative_token_balance")


@pytest.mark.guitest
def test_close_dialog_with_esc_button(window):
QTest.mouseClick(window.left_menu_button_new_channel, Qt.LeftButton)
Expand Down

0 comments on commit 00b1c1a

Please sign in to comment.