Skip to content

Commit

Permalink
Merge pull request #717 from Stremio/fix/server-missing-proxy_streams…
Browse files Browse the repository at this point in the history
…_enabled-settings-key

test(streamio_server): response
  • Loading branch information
elpiel authored Aug 19, 2024
2 parents 9e27bd7 + 2f6a990 commit 30e92be
Showing 1 changed file with 90 additions and 0 deletions.
90 changes: 90 additions & 0 deletions src/types/streaming_server/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,93 @@ pub struct GetHTTPSResponse {
pub domain: String,
pub port: u16,
}

#[cfg(test)]
mod test {
use super::*;

#[test]
fn test_server_settings_response_deserialization() {
let json = serde_json::json!({
"options": [
{
"id": "localAddonEnabled",
"label": "ENABLE_LOCAL_FILES_ADDON",
"type": "checkbox"
},
{
"id": "remoteHttps",
"label": "ENABLE_REMOTE_HTTPS_CONN",
"type": "select",
"class": "https",
"icon": true,
"selections": [
{
"name": "Disabled",
"val": ""
},
{
"name": "172.18.0.7",
"val": "172.18.0.7"
}
]
},
{
"id": "cacheSize",
"label": "CACHING",
"type": "select",
"class": "caching",
"icon": true,
"selections": [
{
"name": "no caching",
"val": 0
},
{
"name": "2GB",
"val": 2147483648_u64
},
{
"name": "5GB",
"val": 5368709120_u64
},
{
"name": "10GB",
"val": 10737418240_u64
},
{
"name": "∞",
"val": null
}
]
}
],
"values": {
"serverVersion": "4.20.8",
"appPath": "/root/.stremio-server",
"cacheRoot": "/root/.stremio-server",
"cacheSize": 2147483648_u64,
"btMaxConnections": 55,
"btHandshakeTimeout": 20000,
"btRequestTimeout": 4000,
"btDownloadSpeedSoftLimit": 2621440,
"btDownloadSpeedHardLimit": 3670016,
"btMinPeersForStable": 5,
"remoteHttps": "",
"localAddonEnabled": false,
"transcodeHorsepower": 0.75,
"transcodeMaxBitRate": 0,
"transcodeConcurrency": 1,
"transcodeTrackConcurrency": 1,
"transcodeHardwareAccel": false,
"transcodeProfile": null,
"allTranscodeProfiles": [],
"transcodeMaxWidth": 1920
},
"baseUrl": "http://172.18.0.7:11470"
});

let _response = serde_json::from_value::<SettingsResponse>(json)
.expect("Should be able to deserialize settings response");
}
}

0 comments on commit 30e92be

Please sign in to comment.