97
97
Test.add_data_func ("/Unit/SmartScopes/Parse", Fixture.create<SmartScopesUtilTester> (SmartScopesUtilTester.test_smart_scopes_parse));
98
98
Test.add_data_func ("/Unit/SmartScopes/ParseErrors", Fixture.create<SmartScopesUtilTester> (SmartScopesUtilTester.test_smart_scopes_parse_errors));
99
Test.add_data_func ("/Unit/SmartScopes/ParseMissingOptionalFields", Fixture.create<SmartScopesUtilTester> (SmartScopesUtilTester.test_smart_scopes_parse_missing_optional_fields));
99
100
Test.add_data_func ("/Unit/SmartScopes/SearchString", Fixture.create<SmartScopesUtilTester> (SmartScopesUtilTester.test_smart_scopes_search_string));
100
101
Test.add_data_func ("/Unit/SmartScopes/OnChunkData", Fixture.create<SmartScopesUtilTester> (SmartScopesUtilTester.test_smart_scopes_on_chunk_data));
101
102
Test.add_data_func ("/Unit/SmartScopes/Metrics", Fixture.create<SmartScopesUtilTester> (SmartScopesUtilTester.test_smart_scopes_metrics));
702
703
catch (SmartScopes.ParseError e) { got_excp = true; }
706
internal void test_smart_scopes_parse_missing_optional_fields ()
709
var search_handler = new SmartScopes.SearchResponseHandler ();
711
// missing or null 'images' in the metadata
712
search_handler.parse_results_line ("""{"info": {"searchin-scope.scope": [{"title": "search in foursquare...", "icon_hint": "file:///usr/share/icons/unity-icon-theme/places/svg/group-info.svg", "uri": "scopes-query://foursquare:drink", "metadata": {"images":null}}, {"title": "search in recipepuppy...", "icon_hint": "file:///usr/share/icons/unity-icon-theme/places/svg/group-recipes.svg", "uri": "scopes-query://recipepuppy:drink", "metadata": {}}, {"title": "search in grooveshark...", "icon_hint": "file:///usr/share/icons/unity-icon-theme/places/svg/service-grooveshark.svg", "uri": "scopes-query://grooveshark:drink", "metadata": {}}, {"title": "search in ebay...", "icon_hint": "file:///usr/share/icons/unity-icon-theme/places/svg/service-ebay.svg", "uri": "scopes-query://ebay:drink", "metadata": {}}, {"title": "search in songkick...", "icon_hint": "file:///usr/share/icons/unity-icon-theme/places/svg/group-music.svg", "uri": "scopes-query://songkick:drink", "metadata": {}}]}, "type": "results"}""",
714
assert (scope_id == "searchin-scope.scope");
715
if (row_count == 0) {
716
assert (row[0].get_string () == "x-unity-no-preview-scopes-query://foursquare:drink"); // uri
717
assert (row[1].get_string () == "file:///usr/share/icons/unity-icon-theme/places/svg/group-info.svg"); // icon hint
718
assert (row[2].get_uint32 () == 0); // category
719
assert (row[3].get_uint32 () == Unity.ResultType.DEFAULT); // result type
720
assert (row[4].get_string () == "text/html"); // mimetype
721
assert (row[5].get_string () == "search in foursquare..."); // title
722
assert (row[6].get_string () == ""); // comment
723
assert (row[7].get_string () == "x-unity-no-preview-scopes-query://foursquare:drink"); // dnd uri
724
assert (row[8].is_of_type (new VariantType ("a{sv}")) && row[8].n_children () == 0); // metadata
728
(recommend) => { assert_not_reached (); });
730
assert (row_count == 5);
705
733
const string SERVER_URI = "https://foobar.ubuntu.com";
706
734
const string SEARCH_URI_PREFIX = SERVER_URI + "/smartscopes/v1/search";