Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
9c16ded0
Commit
9c16ded0
authored
9 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug in explorer
parent
931c2c7c
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sakia/core/graph/explorer_graph.py
+3
-3
3 additions, 3 deletions
src/sakia/core/graph/explorer_graph.py
src/sakia/tests/unit/core/graph/test_explorer_graph.py
+19
-2
19 additions, 2 deletions
src/sakia/tests/unit/core/graph/test_explorer_graph.py
with
22 additions
and
5 deletions
src/sakia/core/graph/explorer_graph.py
+
3
−
3
View file @
9c16ded0
...
...
@@ -33,8 +33,8 @@ class ExplorerGraph(BaseGraph):
if
self
.
exploration_task
:
if
self
.
explored_identity
is
not
identity
or
steps
!=
self
.
steps
:
self
.
exploration_task
.
cancel
()
else
:
return
#
else:
#
return
self
.
nx_graph
.
clear
()
self
.
explored_identity
=
identity
self
.
steps
=
steps
...
...
@@ -69,6 +69,7 @@ class ExplorerGraph(BaseGraph):
for
step
in
range
(
0
,
steps
):
while
len
(
explorable
[
step
])
>
0
:
current_identity
=
explorable
[
step
].
pop
()
# for each pubkey connected...
if
current_identity
not
in
explored
:
self
.
current_identity_changed
.
emit
(
current_identity
.
pubkey
)
...
...
@@ -95,5 +96,4 @@ class ExplorerGraph(BaseGraph):
explored
.
append
(
current_identity
)
logging
.
debug
(
"
New identity explored : {pubkey}
"
.
format
(
pubkey
=
current_identity
.
pubkey
[:
5
]))
self
.
graph_changed
.
emit
()
current_identity
=
explorable
[
step
].
pop
()
self
.
current_identity_changed
.
emit
(
""
)
This diff is collapsed.
Click to expand it.
src/sakia/tests/unit/core/graph/test_explorer_graph.py
+
19
−
2
View file @
9c16ded0
...
...
@@ -72,7 +72,7 @@ class TestExplorerGraph(unittest.TestCase, QuamashTest):
}
])
self
.
idC
.
unique_valid_certified_by
=
CoroutineMock
(
spec
=
'
core.registry.Identity.certifie
r
d_by
'
,
self
.
idC
.
unique_valid_certified_by
=
CoroutineMock
(
spec
=
'
core.registry.Identity.certified_by
'
,
return_value
=
[
{
'
cert_time
'
:
49100
,
...
...
@@ -123,7 +123,7 @@ class TestExplorerGraph(unittest.TestCase, QuamashTest):
@patch
(
'
sakia.core.Application
'
)
@patch
(
'
sakia.core.Community
'
)
@patch
(
'
time.time
'
,
Mock
(
return_value
=
50000
))
def
test_explore_full
(
self
,
app
,
community
):
def
test_explore_full
_from_center
(
self
,
app
,
community
):
community
.
parameters
=
CoroutineMock
(
return_value
=
{
'
sigValidity
'
:
1000
})
community
.
network
.
confirmations
=
Mock
(
side_effect
=
lambda
n
:
4
if
996
else
None
)
app
.
preferences
=
{
'
expert_mode
'
:
True
}
...
...
@@ -137,6 +137,23 @@ class TestExplorerGraph(unittest.TestCase, QuamashTest):
self
.
lp
.
run_until_complete
(
exec_test
())
@patch
(
'
sakia.core.Application
'
)
@patch
(
'
sakia.core.Community
'
)
@patch
(
'
time.time
'
,
Mock
(
return_value
=
50000
))
def
test_explore_full_from_extremity
(
self
,
app
,
community
):
community
.
parameters
=
CoroutineMock
(
return_value
=
{
'
sigValidity
'
:
1000
})
community
.
network
.
confirmations
=
Mock
(
side_effect
=
lambda
n
:
4
if
996
else
None
)
app
.
preferences
=
{
'
expert_mode
'
:
True
}
explorer_graph
=
ExplorerGraph
(
app
,
community
)
async
def
exec_test
():
await
explorer_graph
.
_explore
(
self
.
idA
,
5
)
self
.
assertEqual
(
len
(
explorer_graph
.
nx_graph
.
nodes
()),
5
)
self
.
assertEqual
(
len
(
explorer_graph
.
nx_graph
.
edges
()),
4
)
self
.
lp
.
run_until_complete
(
exec_test
())
@patch
(
'
sakia.core.Application
'
)
@patch
(
'
sakia.core.Community
'
)
@patch
(
'
time.time
'
,
Mock
(
return_value
=
50000
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment