mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-13 03:59:12 +00:00
test(rust): read the blocked IP fixture through an rstest once fixture
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
9c88e49715
commit
0cd7307b91
1 changed files with 10 additions and 5 deletions
|
|
@ -623,14 +623,19 @@ mod tests {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn blocks_everything_the_python_policy_blocks() {
|
||||
let fixture: BlockedIpFixture = serde_json::from_str(include_str!(concat!(
|
||||
#[rstest::fixture]
|
||||
#[once]
|
||||
fn python_verdicts() -> BlockedIpFixture {
|
||||
serde_json::from_str(include_str!(concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/generated/blocked_ips.json"
|
||||
)))
|
||||
.expect("blocked_ips.json matches the fixture schema");
|
||||
let verdicts: Vec<(IpAddr, bool, bool)> = fixture
|
||||
.expect("blocked_ips.json matches the fixture schema")
|
||||
}
|
||||
|
||||
#[rstest::rstest]
|
||||
fn blocks_everything_the_python_policy_blocks(python_verdicts: &BlockedIpFixture) {
|
||||
let verdicts: Vec<(IpAddr, bool, bool)> = python_verdicts
|
||||
.rows
|
||||
.iter()
|
||||
.map(|row| (row.address, row.blocked, is_blocked_ip(row.address)))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue