Skip to content

Commit

Permalink
Added test for AuthorizationError exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgruner committed Jan 13, 2021
1 parent 7143202 commit 9604e05
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,4 +459,16 @@ mod tests {
};
DeepL::new(key).translate(None, texts).unwrap();
}

#[test]
#[should_panic(expected = "Error(AuthorizationError")]
fn translate_unauthorized() {
let key = "wrong_key".to_string();
let texts = TranslatableTextList {
source_language: Some("DE".to_string()),
target_language: "EN-US".to_string(),
texts: vec!["ja".to_string()],
};
DeepL::new(key).translate(None, texts).unwrap();
}
}

0 comments on commit 9604e05

Please sign in to comment.