Skip to content

Commit

Permalink
Fix GUI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
egbertbouman committed Jun 11, 2020
1 parent c5de5d7 commit b4e7141
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def setup_routes(self):
web.get('/tunnel/relays', self.get_relays),
web.get('/tunnel/exits', self.get_exits),
web.get('/dht/statistics', self.get_dht_stats),
web.get('/dht/buckets', self.get_dht_buckets),
web.get('/overlays', self.get_overlays),
]
)
Expand All @@ -41,6 +42,9 @@ async def get_exits(self, _):
async def get_dht_stats(self, _):
return RESTResponse({"statistics": tribler_utils.tribler_data.dht_stats})

async def get_dht_buckets(self, _):
return RESTResponse({"buckets": tribler_utils.tribler_data.dht_buckets})

async def get_overlays(self, _):
return RESTResponse(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(self):
self.transactions = []
self.orders = []
self.dht_stats = {}
self.dht_buckets = {}
self.video_player_port = get_random_port()
self.tunnel_circuits = []
self.tunnel_relays = []
Expand All @@ -50,6 +51,7 @@ def generate(self):
self.generate_transactions()
self.generate_orders()
self.generate_dht_stats()
self.generate_dht_buckets()
self.generate_tunnels()

# Create settings
Expand Down Expand Up @@ -259,6 +261,13 @@ def generate_dht_stats(self):
"routing_table_size": randint(10, 50),
}

def generate_dht_buckets(self):
self.dht_buckets = [{
"prefix": format(randint(1, 7), '03b'),
"last_changed": randint(1500000000, 1590000000),
"peers": []
}]

def generate_tunnels(self):
self.tunnel_circuits = [Circuit() for _ in range(randint(2, 10))]
self.tunnel_relays = [Relay() for _ in range(randint(2, 10))]
Expand Down
8 changes: 6 additions & 2 deletions src/tribler-gui/tribler_gui/tests/test_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,12 @@ def test_debug_pane(self):
self.screenshot(window.debug_window, name="debug_panel_tunnel_exits_tab")

window.debug_window.debug_tab_widget.setCurrentIndex(5)
self.wait_for_list_populated(window.debug_window.dht_tree_widget)
self.screenshot(window.debug_window, name="debug_panel_dht_tab")
self.wait_for_list_populated(window.debug_window.dhtstats_tree_widget)
self.screenshot(window.debug_window, name="debug_panel_dht_stats_tab")

window.debug_window.dht_tab_widget.setCurrentIndex(1)
self.wait_for_list_populated(window.debug_window.buckets_tree_widget)
self.screenshot(window.debug_window, name="debug_panel_dht_buckets_tab")

window.debug_window.debug_tab_widget.setCurrentIndex(6)
self.wait_for_list_populated(window.debug_window.events_tree_widget)
Expand Down

0 comments on commit b4e7141

Please sign in to comment.