yt_transcript_rs/tests/
test_utils.rs1#[cfg(not(feature = "ci"))]
2use reqwest::Client;
3use std::sync::Once;
4
5use crate::api::YouTubeTranscriptApi;
6
7static INIT: Once = Once::new();
8
9pub fn setup() {
11 INIT.call_once(|| {
12 });
14}
15
16#[cfg(feature = "ci")]
21pub fn create_api() -> YouTubeTranscriptApi {
22 let client = super::mocks::create_mock_client();
24
25 YouTubeTranscriptApi::new(None, None, Some(client)).unwrap()
26}
27
28#[cfg(not(feature = "ci"))]
29pub fn create_api() -> YouTubeTranscriptApi {
30 let client = Client::builder()
32 .user_agent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36")
33 .build()
34 .unwrap();
35
36 YouTubeTranscriptApi::new(None, None, Some(client)).unwrap()
37}
38
39pub const MULTILANG_VIDEO_ID: &str = "arj7oStGLkU"; pub const AUTOGENERATED_VIDEO_ID: &str = "";
44
45pub const MANUAL_VIDEO_ID: &str = "";
47
48pub const NON_EXISTENT_VIDEO_ID: &str = "xxxxxxxxxxx";
50
51pub const AGE_RESTRICTED_VIDEO_ID: &str = "";
53
54pub const DISABLED_TRANSCRIPTS_VIDEO_ID: &str = "";