Skip to content
Open
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,25 @@ async fn test_device_get_model() {
let mut pact_builder_async = get_pact_builder_async_obj().await;

let mut result = HashMap::new();

result.insert(
"stbVersion".into(),
ContractMatcher::MatchType("AX061AEI_VBN_1911_sprint_20200109040424sdy".into()),
ContractMatcher::MatchRegex(
r"^[A-Z0-9]+_VBN_[A-Za-z0-9]+_sprint_\d{14}sdy(_[A-Z0-9_]+)*$".into(),
"AX061AEI_VBN_1911_sprint_20200109040424sdy".into(),
),
);

result.insert(
"receiverVersion".into(),
ContractMatcher::MatchRegex(
r"^[0-9]\d*.[0-9]\d*.[0-9]\d*.[0-9]\d*$".into(),
"3.14.0.0".into(),
),
ContractMatcher::MatchRegex(r"^\d+\.\d+\.\d+\.\d+$".into(), "3.14.0.0".into()),
);

result.insert(
"stbTimestamp".into(),
ContractMatcher::MatchRegex(
"^\\w{3} \\d{1,2} \\w{3} (?:\\d{2})?\\d{2} \\d{2}:\\d{2}:\\d{2} UTC$".into(),
"Wed 01 Jan 2024 02:45:28 UTC".into(),
r"^\w{3} \d{2} \w{3} \d{4} \d{2}:\d{2}:\d{2} [A-Z ]*UTC$".into(),
"Thu 09 Jan 2020 04:04:24 AP UTC".into(),
),
);
result.insert("success".into(), ContractMatcher::MatchBool(true));
Expand All @@ -137,7 +140,7 @@ async fn test_device_get_model() {
.to_string(),
json!({
"jsonrpc": "2.0",
"id": 0,
"id": 42,
"method": "org.rdk.System.1.getSystemVersions"
})
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async fn test_text_track_set_font_family() {
"id": "matching(integer, 2)",
"method": "org.rdk.TextTrack.setFontFamily",
"params": {
"fontFamily": "matching(type, 'Verdana')"
"fontFamily": "matching(regex, '^(MONOSPACED_SERIF|PROPORTIONAL_SERIF|MONOSPACE_SANS_SERIF|PROPORTIONAL_SANS_SERIF|CASUAL|CURSIVE|SMALL_CAPITAL|CONTENT_DEFAULT)$', 'MONOSPACED_SERIF')"
}
},
"requestMetadata": {
Expand All @@ -105,7 +105,7 @@ async fn test_text_track_set_font_family() {
"response": [{
"jsonrpc": "matching(type, '2.0')",
"id": "matching(integer, 2)",
"result": "matching(type, 'SUCCESS')"
"result": null
}]
}))
.await;
Expand All @@ -128,7 +128,7 @@ async fn test_text_track_set_font_family() {
"id": 2,
"method": "org.rdk.TextTrack.setFontFamily",
"params": {
"fontFamily": "Verdana"
"fontFamily": "MONOSPACED_SERIF"
}
})
)
Expand Down Expand Up @@ -191,7 +191,7 @@ async fn test_text_track_set_font_size() {
"id": "matching(integer, 4)",
"method": "org.rdk.TextTrack.setFontSize",
"params": {
"fontSize": "matching(type, '18px')"
"fontSize": "matching(regex, '^(-1|0|1|2|3)$', '1')"
}
},
"requestMetadata": {
Expand All @@ -200,7 +200,7 @@ async fn test_text_track_set_font_size() {
"response": [{
"jsonrpc": "matching(type, '2.0')",
"id": "matching(integer, 4)",
"result": "matching(type, 'SUCCESS')"
"result": null
}]
}))
.await;
Expand All @@ -223,7 +223,7 @@ async fn test_text_track_set_font_size() {
"id": 4,
"method": "org.rdk.TextTrack.setFontSize",
"params": {
"fontSize": "18px"
"fontSize": 1
}
})
)
Expand Down Expand Up @@ -286,7 +286,7 @@ async fn test_text_track_set_font_color() {
"id": "matching(integer, 6)",
"method": "org.rdk.TextTrack.setFontColor",
"params": {
"fontColor": "matching(type, '#FF0000')"
"fontColor": "matching(regex, '^$|^#[0-9A-Fa-f]{6}$', '\"#FF0000\"')"
}
},
"requestMetadata": {
Expand All @@ -295,7 +295,7 @@ async fn test_text_track_set_font_color() {
"response": [{
"jsonrpc": "matching(type, '2.0')",
"id": "matching(integer, 6)",
"result": "matching(type, 'SUCCESS')"
"result": null
}]
}))
.await;
Expand Down Expand Up @@ -381,7 +381,7 @@ async fn test_text_track_set_font_edge() {
"id": "matching(integer, 8)",
"method": "org.rdk.TextTrack.setFontEdge",
"params": {
"fontEdge": "matching(type, 'raised')"
"fontEdge": "matching(regex, '^(none|raised|depressed|uniform|drop_shadow_left|drop_shadow_right|content_default)$', 'raised')"
}
},
"requestMetadata": {
Expand All @@ -390,7 +390,7 @@ async fn test_text_track_set_font_edge() {
"response": [{
"jsonrpc": "matching(type, '2.0')",
"id": "matching(integer, 8)",
"result": "matching(type, 'SUCCESS')"
"result": null
}]
}))
.await;
Expand Down Expand Up @@ -478,7 +478,7 @@ async fn test_text_track_set_font_edge_color() {
"id": "matching(integer, 10)",
"method": "org.rdk.TextTrack.setFontEdgeColor",
"params": {
"fontEdgeColor": "matching(type, '#FF00FF')"
"fontEdgeColor": "matching(regex, '^$|^#[0-9A-Fa-f]{6}$', '\"#FFFFFF\"')"
}
},
"requestMetadata": {
Expand All @@ -487,7 +487,7 @@ async fn test_text_track_set_font_edge_color() {
"response": [{
"jsonrpc": "matching(type, '2.0')",
"id": "matching(integer, 10)",
"result": "matching(type, 'SUCCESS')"
"result": null
}]
}))
.await;
Expand All @@ -511,7 +511,7 @@ async fn test_text_track_set_font_edge_color() {
"id": 10,
"method": "org.rdk.TextTrack.setFontEdgeColor",
"params": {
"fontEdgeColor": "#FF00FF"
"fontEdgeColor": "#FFFFFF"
}
})
)
Expand All @@ -534,7 +534,7 @@ async fn test_text_track_get_font_opacity() {
"response": [{
"jsonrpc": "matching(type, '2.0')",
"id": "matching(integer, 11)",
"result": "matching(type, '0.8')"
"result": "matching(regex, '^(-1|[0-9]{1,2}|100)$', '90')"
}]
})).await;
i.test_name("get_font_opacity");
Expand Down Expand Up @@ -574,7 +574,7 @@ async fn test_text_track_set_font_opacity() {
"id": "matching(integer, 12)",
"method": "org.rdk.TextTrack.setFontOpacity",
"params": {
"fontOpacity": "matching(type, '0.9')"
"fontOpacity": "matching(regex, '^(-1|[0-9]{1,2}|100)$', '1')"
}
},
"requestMetadata": {
Expand All @@ -583,7 +583,7 @@ async fn test_text_track_set_font_opacity() {
"response": [{
"jsonrpc": "matching(type, '2.0')",
"id": "matching(integer, 12)",
"result": "matching(type, 'SUCCESS')"
"result": null
}]
}))
.await;
Expand All @@ -606,7 +606,7 @@ async fn test_text_track_set_font_opacity() {
"id": 12,
"method": "org.rdk.TextTrack.setFontOpacity",
"params": {
"fontOpacity": "0.9"
"fontOpacity": 1
}
})
)
Expand All @@ -629,7 +629,7 @@ async fn test_text_track_get_background_color() {
"response": [{
"jsonrpc": "matching(type, '2.0')",
"id": "matching(integer, 13)",
"result": "matching(type, '#000000')"
"result": "matching(regex, '\"^$|^#[0-9A-Fa-f]{6}$\"', '\"#FFFFFF\"')"
}]
})).await;
i.test_name("get_background_color");
Expand Down Expand Up @@ -671,7 +671,7 @@ async fn test_text_track_set_background_color() {
"id": "matching(integer, 14)",
"method": "org.rdk.TextTrack.setBackgroundColor",
"params": {
"backgroundColor": "matching(type, '#FFFFFF')"
"backgroundColor": "matching(regex, '^$|^#[0-9A-Fa-f]{6}$', '\"#FFFFFF\"')"
}
},
"requestMetadata": {
Expand All @@ -680,7 +680,7 @@ async fn test_text_track_set_background_color() {
"response": [{
"jsonrpc": "matching(type, '2.0')",
"id": "matching(integer, 14)",
"result": "matching(type, 'SUCCESS')"
"result": null
}]
}))
.await;
Expand Down Expand Up @@ -727,7 +727,7 @@ async fn test_text_track_get_background_opacity() {
"response": [{
"jsonrpc": "matching(type, '2.0')",
"id": "matching(integer, 15)",
"result": "matching(type, '0.7')"
"result": "matching(regex, '^(-1|[0-9]{1,2}|100)$', '1')"
}]
})).await;
i.test_name("get_background_opacity");
Expand Down Expand Up @@ -769,7 +769,7 @@ async fn test_text_track_set_background_opacity() {
"id": "matching(integer, 16)",
"method": "org.rdk.TextTrack.setBackgroundOpacity",
"params": {
"backgroundOpacity": "matching(type, '0.85')"
"backgroundOpacity": "matching(regex, '^(-1|[0-9]{1,2}|100)$', '1')"
}
},
"requestMetadata": {
Expand All @@ -778,7 +778,7 @@ async fn test_text_track_set_background_opacity() {
"response": [{
"jsonrpc": "matching(type, '2.0')",
"id": "matching(integer, 16)",
"result": "matching(type, 'SUCCESS')"
"result": null
}]
}))
.await;
Expand All @@ -802,7 +802,7 @@ async fn test_text_track_set_background_opacity() {
"id": 16,
"method": "org.rdk.TextTrack.setBackgroundOpacity",
"params": {
"backgroundOpacity": "0.85"
"backgroundOpacity": 1
}
})
)
Expand All @@ -825,7 +825,7 @@ async fn test_text_track_get_window_color() {
"response": [{
"jsonrpc": "matching(type, '2.0')",
"id": "matching(integer, 17)",
"result": "matching(type, '#CCCCCC')"
"result": "matching(regex, '^$|^#[0-9A-Fa-f]{6}$', '\"#FFFFFF\"')"
}]
})).await;
i.test_name("get_window_color");
Expand Down Expand Up @@ -874,7 +874,7 @@ async fn test_text_track_set_window_color() {
"response": [{
"jsonrpc": "matching(type, '2.0')",
"id": "matching(integer, 18)",
"result": "matching(type, 'SUCCESS')"
"result": null
}]
}))
.await;
Expand Down Expand Up @@ -920,7 +920,7 @@ async fn test_text_track_get_window_opacity() {
"response": [{
"jsonrpc": "matching(type, '2.0')",
"id": "matching(integer, 19)",
"result": "matching(type, '0.6')"
"result": "matching(regex, '^(-1|[0-9]{1,2}|100)$', '1')"
}]
})).await;
i.test_name("get_window_opacity");
Expand Down Expand Up @@ -962,7 +962,7 @@ async fn test_text_track_set_window_opacity() {
"id": "matching(integer, 20)",
"method": "org.rdk.TextTrack.setWindowOpacity",
"params": {
"windowOpacity": "matching(type, '0.75')"
"windowOpacity": "matching(regex, '^(-1|[0-9]{1,2}|100)$', '1')"
}
},
"requestMetadata": {
Expand All @@ -971,7 +971,7 @@ async fn test_text_track_set_window_opacity() {
"response": [{
"jsonrpc": "matching(type, '2.0')",
"id": "matching(integer, 20)",
"result": "matching(type, 'SUCCESS')"
"result": null
}]
}))
.await;
Expand All @@ -995,7 +995,7 @@ async fn test_text_track_set_window_opacity() {
"id": 20,
"method": "org.rdk.TextTrack.setWindowOpacity",
"params": {
"windowOpacity": "0.75"
"windowOpacity": 1
}
})
)
Expand Down
Loading
Loading