Skip to content

Commit

Permalink
test: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Serhii Khalymon authored and eirenik0 committed Jul 20, 2024
1 parent 2fa3beb commit 8abcd98
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ impl From<&Url> for GstClient {
mod spec {
use super::*;
const BASE_URL: &'static str = "http://10.211.55.4:5000";
const PIPELINE_NAME: &'static str = "test pipeline";

fn expect_url() -> Url {
Url::parse(BASE_URL).unwrap()
Expand All @@ -167,6 +168,14 @@ mod spec {
assert_eq!(client.base_url, expect_url());
}

#[tokio::test]
async fn create_pipeline() {
if let Ok(client) = GstClient::build(BASE_URL) {
let res = client.pipeline(PIPELINE_NAME).create("").await;
println!("{:?}", res);
assert!(res.is_ok());
};
}
#[tokio::test]
async fn retrieve_pipelines() {
if let Ok(client) = GstClient::build(BASE_URL) {
Expand All @@ -179,7 +188,7 @@ mod spec {
#[tokio::test]
async fn retrieve_pipeline_graph() {
if let Ok(client) = GstClient::build(BASE_URL) {
let res = client.pipeline("test-pipeline").graph().await;
let res = client.pipeline(PIPELINE_NAME).graph().await;
println!("{:?}", res);
assert!(res.is_ok());
};
Expand All @@ -188,15 +197,15 @@ mod spec {
#[tokio::test]
async fn retrieve_pipeline_elements() {
if let Ok(client) = GstClient::build(BASE_URL) {
let res = client.pipeline("test-pipeline").elements().await;
let res = client.pipeline(PIPELINE_NAME).elements().await;
println!("{:?}", res);
assert!(res.is_ok());
};
}
#[tokio::test]
async fn retrieve_pipeline_properties() {
if let Ok(client) = GstClient::build(BASE_URL) {
let res = client.pipeline("test-pipeline").properties().await;
let res = client.pipeline(PIPELINE_NAME).properties().await;
println!("{:?}", res);
assert!(res.is_ok());
};
Expand All @@ -205,7 +214,7 @@ mod spec {
async fn retrieve_pipeline_element_property() {
if let Ok(client) = GstClient::build(BASE_URL) {
let res = client
.pipeline("test-pipeline")
.pipeline(PIPELINE_NAME)
.element("rtmp2src")
.property("location")
.await;
Expand All @@ -216,7 +225,7 @@ mod spec {
#[tokio::test]
async fn retrieve_pipeline_bus_read() {
if let Ok(client) = GstClient::build(BASE_URL) {
let res = client.pipeline("test-pipeline").bus().read().await;
let res = client.pipeline(PIPELINE_NAME).bus().read().await;
println!("{:?}", res);
assert!(res.is_ok());
};
Expand Down

0 comments on commit 8abcd98

Please sign in to comment.