Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Duniter v2S
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
rust
Duniter v2S
Commits
65772940
Commit
65772940
authored
1 year ago
by
Hugo Trentesaux
Browse files
Options
Downloads
Patches
Plain Diff
add wot tests related to issue
#136
parent
b871e19d
No related branches found
No related tags found
1 merge request
!215
refac membership
Pipeline
#34848
failed
1 year ago
Stage: labels
Stage: quality
Stage: build
Stage: tests
Changes
1
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pallets/duniter-wot/src/tests.rs
+52
-2
52 additions, 2 deletions
pallets/duniter-wot/src/tests.rs
with
52 additions
and
2 deletions
pallets/duniter-wot/src/tests.rs
+
52
−
2
View file @
65772940
...
...
@@ -584,8 +584,7 @@ fn test_cert_can_not_be_issued() {
));
run_to_block
(
11
);
// /!\ COUNTERINTUITIVE BEHAVIOR
// Dave should not be able to receive a smith cert since he did not request smith membership
// Dave should be able to receive a smith cert since
assert_ok!
(
SmithCert
::
add_cert
(
RuntimeOrigin
::
signed
(
3
),
3
,
4
));
// Bob renews his smith certification towards Alice
assert_ok!
(
SmithCert
::
add_cert
(
RuntimeOrigin
::
signed
(
2
),
2
,
1
));
...
...
@@ -646,3 +645,54 @@ fn test_cert_can_not_be_issued() {
// she would have been able to emit a cert without being member
})
}
/// test non smith identity can not emit smith cert
#[test]
fn
test_non_smith_can_not_issue_smith_cert
()
{
new_test_ext
(
4
,
3
)
.execute_with
(||
{
assert_noop!
(
SmithCert
::
add_cert
(
RuntimeOrigin
::
signed
(
4
),
4
,
1
),
pallet_certification
::
Error
::
<
Test
,
Instance2
>
::
NotEnoughCertReceived
);
})
}
/// FIXME this test should not fail with NotRespectCertPeriod but NotSmith or somthing like that
/// test non smith identity can not emit smith cert
#[test]
fn
test_non_smith_with_certs_can_not_issue_smith_cert
()
{
new_test_ext
(
4
,
3
)
.execute_with
(||
{
run_to_block
(
2
);
assert_ok!
(
SmithCert
::
add_cert
(
RuntimeOrigin
::
signed
(
1
),
1
,
4
));
assert_ok!
(
SmithCert
::
add_cert
(
RuntimeOrigin
::
signed
(
2
),
2
,
4
));
assert_ok!
(
SmithCert
::
add_cert
(
RuntimeOrigin
::
signed
(
3
),
3
,
4
));
assert_noop!
(
SmithCert
::
add_cert
(
RuntimeOrigin
::
signed
(
4
),
4
,
1
),
pallet_certification
::
Error
::
<
Test
,
Instance2
>
::
NotRespectCertPeriod
);
})
}
/// FIXME this test should not succeed because Dave should not be able to issue cert
/// after revocation of his smith membership
/// test non smith identity can not emit smith cert
#[test]
fn
test_revoked_smith_with_certs_can_not_issue_smith_cert
()
{
new_test_ext
(
4
,
3
)
.execute_with
(||
{
run_to_block
(
2
);
assert_ok!
(
SmithCert
::
add_cert
(
RuntimeOrigin
::
signed
(
1
),
1
,
4
));
assert_ok!
(
SmithCert
::
add_cert
(
RuntimeOrigin
::
signed
(
2
),
2
,
4
));
assert_ok!
(
SmithCert
::
add_cert
(
RuntimeOrigin
::
signed
(
3
),
3
,
4
));
assert_ok!
(
SmithMembership
::
claim_membership
(
RuntimeOrigin
::
signed
(
4
)));
assert_noop!
(
SmithCert
::
add_cert
(
RuntimeOrigin
::
signed
(
4
),
4
,
1
),
pallet_certification
::
Error
::
<
Test
,
Instance2
>
::
NotRespectCertPeriod
);
run_to_block
(
4
);
assert_ok!
(
SmithCert
::
add_cert
(
RuntimeOrigin
::
signed
(
4
),
4
,
1
),);
run_to_block
(
5
);
assert_ok!
(
SmithMembership
::
revoke_membership
(
RuntimeOrigin
::
signed
(
4
)));
run_to_block
(
6
);
assert_ok!
(
SmithCert
::
add_cert
(
RuntimeOrigin
::
signed
(
4
),
4
,
1
),);
})
}
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