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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
rust
Duniter v2S
Commits
6f8b8825
Commit
6f8b8825
authored
2 years ago
by
Hugo Trentesaux
Browse files
Options
Downloads
Patches
Plain Diff
test(
#109
): reveal certification renewal issue
parent
ae77a3c4
No related branches found
No related tags found
1 merge request
!159
Fix certification renewal
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pallets/certification/src/tests.rs
+46
-0
46 additions, 0 deletions
pallets/certification/src/tests.rs
with
46 additions
and
0 deletions
pallets/certification/src/tests.rs
+
46
−
0
View file @
6f8b8825
...
...
@@ -176,6 +176,7 @@ fn test_cert_period() {
});
}
// after given validity period, a certification should expire
#[test]
fn
test_cert_expiry
()
{
new_test_ext
(
DefaultCertificationConfig
{
...
...
@@ -215,3 +216,48 @@ fn test_cert_expiry() {
}));
});
}
// when renewing a certification, it should not expire now, but later
#[test]
fn
test_cert_renewal
()
{
new_test_ext
(
DefaultCertificationConfig
{
apply_cert_period_at_genesis
:
false
,
certs_by_receiver
:
btreemap!
[
0
=>
btreemap!
[
1
=>
Some
(
5
),
2
=>
Some
(
20
),
],
1
=>
btreemap!
[
0
=>
Some
(
20
),
2
=>
Some
(
20
),
],
2
=>
btreemap!
[
0
=>
Some
(
20
),
1
=>
Some
(
20
),
],
],
})
.execute_with
(||
{
run_to_block
(
2
);
// renew certification from bob to alice
// this certification should expire 10 blocks later (at block 12)
assert_eq!
(
DefaultCertification
::
add_cert
(
RuntimeOrigin
::
signed
(
1
),
1
,
0
),
Ok
(()
.into
())
);
System
::
assert_last_event
(
RuntimeEvent
::
DefaultCertification
(
Event
::
RenewedCert
{
issuer
:
1
,
receiver
:
0
,
}));
run_to_block
(
12
);
// expiry of previously renewed cert
System
::
assert_last_event
(
RuntimeEvent
::
DefaultCertification
(
Event
::
RemovedCert
{
issuer
:
1
,
issuer_issued_count
:
1
,
receiver
:
0
,
receiver_received_count
:
1
,
expiration
:
true
,
}));
});
}
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