WIP lot V : le tampon câblé dans le serveur (migration 0010, simulation, discard-simulation), tests en cours de reprise — repris tel quel après la coupure du 02/11
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -686,7 +686,7 @@ async fn a_team_link_makes_one_identity_per_opening() {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn in_monnaie_libre_an_invitation_never_votes_on_the_server() {
|
||||
async fn in_monnaie_libre_an_invitation_votes_on_the_server_only_in_simulation() {
|
||||
let (mut admin, _) = Client::new().await;
|
||||
admin.login("Yvv", true).await;
|
||||
let (_, v) = admin
|
||||
@@ -696,17 +696,21 @@ async fn in_monnaie_libre_an_invitation_never_votes_on_the_server() {
|
||||
let mut invited = admin.with(None);
|
||||
let (s, _) = invited.call("POST", "/api/auth/invitation", Some(json!({ "token": token }))).await;
|
||||
assert_eq!(s, StatusCode::OK);
|
||||
// She reads the text and may propose; her vote would go through the chain, for the Ğ1
|
||||
// identity of her wallet (tests/ballots.rs) — off here, without a vote account.
|
||||
// She reads the text and may propose; her vote goes through the chain, for the Ğ1
|
||||
// identity of her wallet (tests/ballots.rs) — closed here, without a vote account: the
|
||||
// vote is simulated, for the identity of her session, marked as such (ADR 0012).
|
||||
let id = doc_id(&mut invited, "monnaie-libre").await;
|
||||
let (s, doc) = invited.call("GET", &format!("/api/docs/{id}"), None).await;
|
||||
assert_eq!(s, StatusCode::OK);
|
||||
assert_eq!(doc["canVote"], false);
|
||||
assert_eq!((doc["vote"]["way"].as_str(), doc["vote"]["reason"].as_str()), (Some("chain"), Some("chain_off")));
|
||||
assert_eq!(doc["canVote"], true);
|
||||
assert_eq!((doc["vote"]["way"].as_str(), doc["vote"]["simulated"].as_bool()), (Some("server"), Some(true)));
|
||||
let p = unit(&doc, "E3")["proposals"][0]["id"].as_str().expect("p").to_owned();
|
||||
let (s, v) = invited.call("POST", &format!("/api/proposals/{p}/vote"), Some(json!({ "choice": "for" }))).await;
|
||||
assert_eq!(s, StatusCode::CONFLICT, "{v}");
|
||||
assert_eq!(v["error"], "chain_only");
|
||||
assert_eq!(s, StatusCode::OK, "{v}");
|
||||
assert_eq!(v["simulated"], true);
|
||||
let (_, doc) = invited.call("GET", &format!("/api/docs/{id}"), None).await;
|
||||
let voted = &unit(&doc, "E3")["proposals"][0];
|
||||
assert_eq!((voted["myVote"].as_str(), voted["myVoteState"].as_str()), (Some("for"), Some("simulated")));
|
||||
// In the test group, every member votes.
|
||||
let essai = doc_id(&mut admin, "essai").await;
|
||||
let (_, d) = admin.call("GET", &format!("/api/docs/{essai}"), None).await;
|
||||
|
||||
Reference in New Issue
Block a user