Skip to content

Commit bcc1728

Browse files
authored
fix bad merge between #751 and #756 (#759)
Signed-off-by: Craig Disselkoen <[email protected]>
1 parent 1304b2e commit bcc1728

File tree

1 file changed

+36
-30
lines changed

1 file changed

+36
-30
lines changed

cedar-policy-core/src/entities.rs

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,10 +1358,11 @@ mod json_parsing_tests {
13581358
]
13591359
);
13601360
assert_matches!(eparser.from_json_value(json.clone()), Err(EntitiesError::Deserialization(e)) => {
1361-
expect_err(&json, &e, &ExpectedErrorMessage::error_and_help(
1361+
expect_err(&json, &miette::Report::new(e), &ExpectedErrorMessageBuilder::error(
13621362
"in uid field of <unknown entity>, expected a literal entity reference, but got `null`",
1363+
).help(
13631364
r#"literal entity references can be made with `{ "type": "SomeType", "id": "SomeId" }`"#,
1364-
));
1365+
).build());
13651366
});
13661367

13671368
let json = serde_json::json!(
@@ -1374,10 +1375,11 @@ mod json_parsing_tests {
13741375
]
13751376
);
13761377
assert_matches!(eparser.from_json_value(json.clone()), Err(EntitiesError::Deserialization(e)) => {
1377-
expect_err(&json, &e, &ExpectedErrorMessage::error_and_help(
1378+
expect_err(&json, &miette::Report::new(e), &ExpectedErrorMessageBuilder::error(
13781379
r#"in uid field of <unknown entity>, expected a literal entity reference, but got `{"id":"bar","type":null}`"#,
1380+
).help(
13791381
r#"literal entity references can be made with `{ "type": "SomeType", "id": "SomeId" }`"#,
1380-
));
1382+
).build());
13811383
});
13821384

13831385
let json = serde_json::json!(
@@ -1390,10 +1392,11 @@ mod json_parsing_tests {
13901392
]
13911393
);
13921394
assert_matches!(eparser.from_json_value(json.clone()), Err(EntitiesError::Deserialization(e)) => {
1393-
expect_err(&json, &e, &ExpectedErrorMessage::error_and_help(
1395+
expect_err(&json, &miette::Report::new(e), &ExpectedErrorMessageBuilder::error(
13941396
r#"in uid field of <unknown entity>, expected a literal entity reference, but got `{"id":null,"type":"foo"}`"#,
1397+
).help(
13951398
r#"literal entity references can be made with `{ "type": "SomeType", "id": "SomeId" }`"#,
1396-
));
1399+
).build());
13971400
});
13981401

13991402
let json = serde_json::json!(
@@ -1406,9 +1409,9 @@ mod json_parsing_tests {
14061409
]
14071410
);
14081411
assert_matches!(eparser.from_json_value(json.clone()), Err(EntitiesError::Deserialization(e)) => {
1409-
expect_err(&json, &e, &ExpectedErrorMessage::error(
1412+
expect_err(&json, &miette::Report::new(e), &ExpectedErrorMessageBuilder::error(
14101413
"invalid type: null, expected a map"
1411-
));
1414+
).build());
14121415
});
14131416

14141417
let json = serde_json::json!(
@@ -1421,9 +1424,9 @@ mod json_parsing_tests {
14211424
]
14221425
);
14231426
assert_matches!(eparser.from_json_value(json.clone()), Err(EntitiesError::Deserialization(e)) => {
1424-
expect_err(&json, &e, &ExpectedErrorMessage::error(
1427+
expect_err(&json, &miette::Report::new(e), &ExpectedErrorMessageBuilder::error(
14251428
r#"in attribute `attr` on `foo::"bar"`, found a `null`; JSON `null`s are not allowed in Cedar"#,
1426-
));
1429+
).build());
14271430
});
14281431

14291432
let json = serde_json::json!(
@@ -1436,9 +1439,9 @@ mod json_parsing_tests {
14361439
]
14371440
);
14381441
assert_matches!(eparser.from_json_value(json.clone()), Err(EntitiesError::Deserialization(e)) => {
1439-
expect_err(&json, &e, &ExpectedErrorMessage::error(
1442+
expect_err(&json, &miette::Report::new(e), &ExpectedErrorMessageBuilder::error(
14401443
r#"in attribute `attr` on `foo::"bar"`, found a `null`; JSON `null`s are not allowed in Cedar"#,
1441-
));
1444+
).build());
14421445
});
14431446

14441447
let json = serde_json::json!(
@@ -1451,9 +1454,9 @@ mod json_parsing_tests {
14511454
]
14521455
);
14531456
assert_matches!(eparser.from_json_value(json.clone()), Err(EntitiesError::Deserialization(e)) => {
1454-
expect_err(&json, &e, &ExpectedErrorMessage::error(
1457+
expect_err(&json, &miette::Report::new(e), &ExpectedErrorMessageBuilder::error(
14551458
r#"in attribute `attr` on `foo::"bar"`, found a `null`; JSON `null`s are not allowed in Cedar"#,
1456-
));
1459+
).build());
14571460
});
14581461

14591462
let json = serde_json::json!(
@@ -1466,9 +1469,9 @@ mod json_parsing_tests {
14661469
]
14671470
);
14681471
assert_matches!(eparser.from_json_value(json.clone()), Err(EntitiesError::Deserialization(e)) => {
1469-
expect_err(&json, &e, &ExpectedErrorMessage::error(
1472+
expect_err(&json, &miette::Report::new(e), &ExpectedErrorMessageBuilder::error(
14701473
r#"in attribute `attr` on `foo::"bar"`, found a `null`; JSON `null`s are not allowed in Cedar"#,
1471-
));
1474+
).build());
14721475
});
14731476

14741477
let json = serde_json::json!(
@@ -1481,9 +1484,9 @@ mod json_parsing_tests {
14811484
]
14821485
);
14831486
assert_matches!(eparser.from_json_value(json.clone()), Err(EntitiesError::Deserialization(e)) => {
1484-
expect_err(&json, &e, &ExpectedErrorMessage::error(
1487+
expect_err(&json, &miette::Report::new(e), &ExpectedErrorMessageBuilder::error(
14851488
r#"in attribute `__extn` on `foo::"bar"`, found a `null`; JSON `null`s are not allowed in Cedar"#,
1486-
));
1489+
).build());
14871490
});
14881491

14891492
let json = serde_json::json!(
@@ -1496,9 +1499,9 @@ mod json_parsing_tests {
14961499
]
14971500
);
14981501
assert_matches!(eparser.from_json_value(json.clone()), Err(EntitiesError::Deserialization(e)) => {
1499-
expect_err(&json, &e, &ExpectedErrorMessage::error(
1502+
expect_err(&json, &miette::Report::new(e), &ExpectedErrorMessageBuilder::error(
15001503
r#"in attribute `__extn` on `foo::"bar"`, found a `null`; JSON `null`s are not allowed in Cedar"#,
1501-
));
1504+
).build());
15021505
});
15031506

15041507
let json = serde_json::json!(
@@ -1511,9 +1514,9 @@ mod json_parsing_tests {
15111514
]
15121515
);
15131516
assert_matches!(eparser.from_json_value(json.clone()), Err(EntitiesError::Deserialization(e)) => {
1514-
expect_err(&json, &e, &ExpectedErrorMessage::error(
1517+
expect_err(&json, &miette::Report::new(e), &ExpectedErrorMessageBuilder::error(
15151518
r#"in attribute `__extn` on `foo::"bar"`, found a `null`; JSON `null`s are not allowed in Cedar"#,
1516-
));
1519+
).build());
15171520
});
15181521

15191522
let json = serde_json::json!(
@@ -1526,9 +1529,9 @@ mod json_parsing_tests {
15261529
]
15271530
);
15281531
assert_matches!(eparser.from_json_value(json.clone()), Err(EntitiesError::Deserialization(e)) => {
1529-
expect_err(&json, &e, &ExpectedErrorMessage::error(
1532+
expect_err(&json, &miette::Report::new(e), &ExpectedErrorMessageBuilder::error(
15301533
"invalid type: null, expected a sequence"
1531-
));
1534+
).build());
15321535
});
15331536

15341537
let json = serde_json::json!(
@@ -1541,10 +1544,11 @@ mod json_parsing_tests {
15411544
]
15421545
);
15431546
assert_matches!(eparser.from_json_value(json.clone()), Err(EntitiesError::Deserialization(e)) => {
1544-
expect_err(&json, &e, &ExpectedErrorMessage::error_and_help(
1547+
expect_err(&json, &miette::Report::new(e), &ExpectedErrorMessageBuilder::error(
15451548
r#"in parents field of `foo::"bar"`, expected a literal entity reference, but got `null`"#,
1549+
).help(
15461550
r#"literal entity references can be made with `{ "type": "SomeType", "id": "SomeId" }`"#,
1547-
));
1551+
).build());
15481552
});
15491553

15501554
let json = serde_json::json!(
@@ -1557,10 +1561,11 @@ mod json_parsing_tests {
15571561
]
15581562
);
15591563
assert_matches!(eparser.from_json_value(json.clone()), Err(EntitiesError::Deserialization(e)) => {
1560-
expect_err(&json, &e, &ExpectedErrorMessage::error_and_help(
1564+
expect_err(&json, &miette::Report::new(e), &ExpectedErrorMessageBuilder::error(
15611565
r#"in parents field of `foo::"bar"`, expected a literal entity reference, but got `{"id":null,"type":"foo"}`"#,
1566+
).help(
15621567
r#"literal entity references can be made with `{ "type": "SomeType", "id": "SomeId" }`"#,
1563-
));
1568+
).build());
15641569
});
15651570

15661571
let json = serde_json::json!(
@@ -1573,10 +1578,11 @@ mod json_parsing_tests {
15731578
]
15741579
);
15751580
assert_matches!(eparser.from_json_value(json.clone()), Err(EntitiesError::Deserialization(e)) => {
1576-
expect_err(&json, &e, &ExpectedErrorMessage::error_and_help(
1581+
expect_err(&json, &miette::Report::new(e), &ExpectedErrorMessageBuilder::error(
15771582
r#"in parents field of `foo::"bar"`, expected a literal entity reference, but got `null`"#,
1583+
).help(
15781584
r#"literal entity references can be made with `{ "type": "SomeType", "id": "SomeId" }`"#,
1579-
));
1585+
).build());
15801586
});
15811587
}
15821588

0 commit comments

Comments
 (0)