def test_check_desktop_exec_webbrowser_missing_webapp(self): '''Test check_desktop_exec_webbrowser - missing --webapp''' c = ClickReviewDesktop(self.test_name) ex = "webbrowser-app --enable-back-forward " + \ "--webappUrlPatterns=https?://mobile.twitter.com/* " + \ "http://mobile.twitter.com" c = ClickReviewDesktop(self.test_name) self.set_test_desktop(self.default_appname, "Exec", ex) c.check_desktop_exec_webbrowser() r = c.click_report expected_counts = {'info': None, 'warn': 0, 'error': 1} self.check_results(r, expected_counts)
def test_check_desktop_exec_webapp_container_1310a(self): '''Test check_desktop_exec_webapp_container on 13.10 framework''' c = ClickReviewDesktop(self.test_name) ex = "webapp-container --enable-back-forward " + \ "--webappUrlPatterns=https?://mobile.twitter.com/* " + \ "http://mobile.twitter.com" c = ClickReviewDesktop(self.test_name) self.set_test_desktop(self.default_appname, "Exec", ex) c.check_desktop_exec_webapp_container() r = c.click_report expected_counts = {'info': 2, 'warn': 0, 'error': 0} self.check_results(r, expected_counts)
def test_check_desktop_exec_webbrowser_non1310(self): '''Test check_desktop_exec_webbrowser without 13.10''' self.set_test_manifest("framework", "not-ubuntu-sdk-13.10") c = ClickReviewDesktop(self.test_name) ex = "webbrowser-app --webapp --enable-back-forward " + \ "--webappUrlPatterns=https?://mobile.twitter.com/* " + \ "http://mobile.twitter.com" c = ClickReviewDesktop(self.test_name) self.set_test_desktop(self.default_appname, "Exec", ex) c.check_desktop_exec_webbrowser() r = c.click_report expected_counts = {'info': 1, 'warn': 0, 'error': 1} self.check_results(r, expected_counts)
def test_check_peer_hooks_disallowed(self): '''Test check_peer_hooks() - disallowed''' c = ClickReviewDesktop(self.test_name) # create a new hooks database for our peer hooks tests tmp = dict() # add our hook tmp["desktop"] = "foo.desktop" # add any required peer hooks tmp["desktop"] = "foo.desktop" tmp["apparmor"] = "foo.apparmor" # add something not allowed tmp["nonexistent"] = "nonexistent-hook" c.manifest["hooks"][self.default_appname] = tmp self._update_test_manifest() # do the test c.check_peer_hooks() r = c.click_report expected_counts = {'info': None, 'warn': 0, 'error': 1} self.check_results(r, expected_counts)
def test_check_desktop_required_keys(self): '''Test check_desktop_required_keys()''' c = ClickReviewDesktop(self.test_name) c.check_desktop_required_keys() r = c.click_report expected_counts = {'info': 2, 'warn': 0, 'error': 0} self.check_results(r, expected_counts)
def test_check_desktop_exec_webbrowser_modelsearchpath_missing_exec(self): '''Test check_desktop_exec_webbrowser_modelsearchpath - missing exec''' c = ClickReviewDesktop(self.test_name) self.set_test_desktop(self.default_appname, "Exec", None) c.check_desktop_exec_webbrowser_modelsearchpath() r = c.click_report expected_counts = {'info': 0, 'warn': 0, 'error': 0} self.check_results(r, expected_counts)
def test_check_desktop_file_valid_empty_name(self): '''Test check_desktop_file_valid() - empty Name''' c = ClickReviewDesktop(self.test_name) self.set_test_desktop(self.default_appname, "Name", "") c.check_desktop_file_valid() r = c.click_report expected_counts = {'info': 0, 'warn': 0, 'error': 1} self.check_results(r, expected_counts)
def test_check_desktop_file_valid_missing_exec(self): '''Test check_desktop_file_valid() - missing Exec''' c = ClickReviewDesktop(self.test_name) self.set_test_desktop(self.default_appname, "Exec", None) c.check_desktop_file_valid() r = c.click_report expected_counts = {'info': 0, 'warn': 0, 'error': 1} self.check_results(r, expected_counts)
def test_check_desktop_required_keys_missing(self): '''Test check_desktop_required_keys()''' c = ClickReviewDesktop(self.test_name) self.set_test_desktop(self.default_appname, "Name", None) c.check_desktop_required_keys() r = c.click_report expected_counts = {'info': 1, 'warn': 0, 'error': 1} self.check_results(r, expected_counts)
def test_check_desktop_x_ubuntu_gettext_domain_mismatch(self): '''Test check_desktop_x_ubuntu_gettext_domain doesn't match''' c = ClickReviewDesktop(self.test_name) self.set_test_desktop(self.default_appname, "X-Ubuntu-Gettext-Domain", "com.example.mismatch") c.check_desktop_x_ubuntu_gettext_domain() r = c.click_report expected_counts = {'info': 0, 'warn': 1, 'error': 0} self.check_results(r, expected_counts)
def test_check_desktop_x_ubuntu_gettext_domain_empty(self): '''Test check_desktop_x_ubuntu_gettext_domain when empty''' c = ClickReviewDesktop(self.test_name) self.set_test_desktop(self.default_appname, "X-Ubuntu-Gettext-Domain", "") c.check_desktop_x_ubuntu_gettext_domain() r = c.click_report expected_counts = {'info': 0, 'warn': 0, 'error': 1} self.check_results(r, expected_counts)
def test_check_desktop_x_ubuntu_gettext_domain_valid(self): '''Test check_desktop_x_ubuntu_gettext_domain valid''' c = ClickReviewDesktop(self.test_name) self.set_test_desktop(self.default_appname, "X-Ubuntu-Gettext-Domain", self.test_control['Package']) c.check_desktop_x_ubuntu_gettext_domain() r = c.click_report expected_counts = {'info': 1, 'warn': 0, 'error': 0} self.check_results(r, expected_counts)
def test_check_desktop_exec_webbrowser_local_app(self): '''Test test_check_desktop_exec_webbrowser_local_app() local app''' c = ClickReviewDesktop(self.test_name) ex = "webapp-container ./www/index.html" self.set_test_desktop(self.default_appname, "Exec", ex) c.check_desktop_exec_webapp_args() r = c.click_report expected_counts = {'info': None, 'warn': 0, 'error': 0} self.check_results(r, expected_counts)
def test_check_desktop_exec_has_deprecated_exec(self): '''Test check_desktop_exec() - Exec has deprecated exec''' c = ClickReviewDesktop(self.test_name) self.set_test_desktop(self.default_appname, "Exec", "cordova-ubuntu-2.8 .") c.check_desktop_exec() r = c.click_report expected_counts = {'info': 0, 'warn': 1, 'error': 0} self.check_results(r, expected_counts)
def test_check_desktop_file_has_valid_exec(self): '''Test check_desktop_exec() - Exec has valid exec''' c = ClickReviewDesktop(self.test_name) self.set_test_desktop(self.default_appname, "Exec", "qmlscene $@ myApp.qml") c.check_desktop_exec() r = c.click_report expected_counts = {'info': 1, 'warn': 0, 'error': 0} self.check_results(r, expected_counts)
def test_check_desktop_exec_webbrowser_modelsearchpath_no_manifest(self): '''Test check_desktop_exec_webbrowser_modelsearchpath() no manifest''' c = ClickReviewDesktop(self.test_name) ex = "webbrowser-app --enable-back-forward --webapp " + \ "--webappModelSearchPath=. http://mobile.twitter.com" self.set_test_desktop(self.default_appname, "Exec", ex) c.check_desktop_exec_webbrowser_modelsearchpath() r = c.click_report expected_counts = {'info': None, 'warn': 0, 'error': 1} self.check_results(r, expected_counts)
def test_check_desktop_exec_webapp_container_html5_launcher_1510(self): '''Test check_desktop_exec_webapp_container - html5 launcher 15.10''' self.set_test_manifest("framework", "ubuntu-sdk-15.10") ex = "ubuntu-html5-app-launcher $@ --www=www" c = ClickReviewDesktop(self.test_name) self.set_test_desktop(self.default_appname, "Exec", ex) c.check_desktop_exec_webapp_container() r = c.click_report expected_counts = {'info': None, 'warn': 0, 'error': 1} self.check_results(r, expected_counts)
def test_check_desktop_exec_webbrowser_modelsearchpath_missing_arg(self): '''Test check_desktop_exec_webbrowser_modelsearchpath() missing arg''' c = ClickReviewDesktop(self.test_name) ex = "webbrowser-app --enable-back-forward --webapp " + \ "http://mobile.twitter.com" self.set_test_desktop(self.default_appname, "Exec", ex) c.check_desktop_exec_webbrowser_modelsearchpath() r = c.click_report expected_counts = {'info': 1, 'warn': 0, 'error': 0} self.check_results(r, expected_counts)
def test_check_desktop_exec_webbrowser_urlpatterns_trailing_glob4(self): '''Test check_desktop_exec_webbrowser_urlpatterns() - trailing glob4''' c = ClickReviewDesktop(self.test_name) ex = "webbrowser-app --enable-back-forward --webapp " + \ "--webappUrlPatterns=https?://www.bbc.co.uk* " + \ "http://www.bbc.co.uk" self.set_test_desktop(self.default_appname, "Exec", ex) c.check_desktop_exec_webbrowser_urlpatterns() r = c.click_report expected_counts = {'info': None, 'warn': 0, 'error': 1} self.check_results(r, expected_counts)
def test_check_desktop_exec_webapp_args_without_required(self): '''Test check_desktop_exec_webapp_args without required''' for exe in ['webbrowser-app --webapp', 'webapp-container']: c = ClickReviewDesktop(self.test_name) ex = "%s --enable-back-forward " % exe + \ "http://mobile.twitter.com" self.set_test_desktop(self.default_appname, "Exec", ex) c.check_desktop_exec_webapp_args() r = c.click_report expected_counts = {'info': None, 'warn': 0, 'error': 1} self.check_results(r, expected_counts)
def test_check_desktop_exec_webbrowser_local_model(self): '''Test test_check_desktop_exec_webbrowser_local_model() invalid model''' c = ClickReviewDesktop(self.test_name) ex = "webapp-container " + \ "--webappModelSearchPath=. " + \ "./www/index.html" self.set_test_desktop(self.default_appname, "Exec", ex) c.check_desktop_exec_webapp_args() r = c.click_report expected_counts = {'info': None, 'warn': 0, 'error': 1} self.check_results(r, expected_counts)
def test_check_desktop_exec_webbrowser_local_pattern(self): '''Test test_check_desktop_exec_webbrowser_local_pattern() invalid pattern''' c = ClickReviewDesktop(self.test_name) ex = "webapp-container " + \ "--webappUrlPatterns=https?://mobile.twitter.com/* " + \ "./www/index.html" self.set_test_desktop(self.default_appname, "Exec", ex) c.check_desktop_exec_webapp_args() r = c.click_report expected_counts = {'info': None, 'warn': 0, 'error': 1} self.check_results(r, expected_counts)
def test_check_desktop_exec_webbrowser_urlpatterns_target_mismatch(self): '''Test check_desktop_exec_webbrowser_urlpatterns() target mismatch''' c = ClickReviewDesktop(self.test_name) ex = "webbrowser-app --enable-back-forward --webapp " + \ "--webappUrlPatterns=https?://mobile.twitter.com/* " + \ "http://mobile.twitter.net" self.set_test_desktop(self.default_appname, "Exec", ex) c.check_desktop_exec_webbrowser_urlpatterns() r = c.click_report expected_counts = {'info': None, 'warn': 1, 'error': 0} self.check_results(r, expected_counts)
def test_check_desktop_exec_webapp_args_with_model_search_path(self): '''Test check_desktop_exec_webapp_args with --webappModelSearchPath''' c = ClickReviewDesktop(self.test_name) for exe in ['webbrowser-app --webapp', 'webapp-container']: ex = "%s --enable-back-forward " % exe + \ "--webappModelSearchPath=. " + \ "http://mobile.twitter.com" self.set_test_desktop(self.default_appname, "Exec", ex) c.check_desktop_exec_webapp_args() r = c.click_report expected_counts = {'info': None, 'warn': 0, 'error': 0} self.check_results(r, expected_counts)
def test_check_desktop_file(self): '''Test check_desktop_file()''' c = ClickReviewDesktop(self.test_name) c.check_desktop_file() r = c.click_report expected = dict() expected['info'] = dict() expected['warn'] = dict() expected['error'] = dict() name = c._get_check_name('files_usable') expected['info'][name] = {"text": "OK"} self.check_results(r, expected=expected)
def test_check_desktop_file_valid(self): '''Test check_desktop_file_valid()''' c = ClickReviewDesktop(self.test_name) c.check_desktop_file_valid() r = c.click_report expected = dict() expected['info'] = dict() expected['warn'] = dict() expected['error'] = dict() name = c._get_check_name('validates', app=self.default_appname) expected['info'][name] = {"text": "OK"} self.check_results(r, expected=expected)
def test_check_desktop_file_snappy_1504(self): '''Test check_desktop_file() - snappy 15.04''' self.set_test_pkgfmt("snap", "15.04") c = ClickReviewDesktop(self.test_name) c.check_desktop_file() r = c.click_report expected = dict() expected['info'] = dict() expected['warn'] = dict() expected['error'] = dict() name = c._get_check_name('files_usable') expected['info'][name] = {"text": "OK"} self.check_results(r, expected=expected)
def test_check_desktop_exec_webbrowser_modelsearchpath_bad_includes(self): '''Test check_desktop_exec_webbrowser_modelsearchpath() bad includes''' c = ClickReviewDesktop(self.test_name) self.set_test_webapp_manifest("unity-webapps-foo/manifest.json", "name", "foo") self.set_test_webapp_manifest("unity-webapps-foo/manifest.json", "includes", "not list") ex = "webbrowser-app --enable-back-forward --webapp " + \ "--webappModelSearchPath=. http://mobile.twitter.com" self.set_test_desktop(self.default_appname, "Exec", ex) c.check_desktop_exec_webbrowser_modelsearchpath() r = c.click_report expected_counts = {'info': None, 'warn': 0, 'error': 1} self.check_results(r, expected_counts)
def test_check_desktop_exec_webbrowser_field_code(self): '''Test check_desktop_exec_webbrowser_field_code() with field code''' c = ClickReviewDesktop(self.test_name) self.set_test_webapp_manifest("unity-webapps-foo/manifest.json", "name", "foo") self.set_test_webapp_manifest("unity-webapps-foo/manifest.json", "includes", ['https?://mobile.twitter.net/*']) ex = "webapp-container --webapp='Zm9v' " + \ "--enable-back-forward --webappModelSearchPath=. %u" self.set_test_desktop(self.default_appname, "Exec", ex) c.check_desktop_exec_webapp_args() r = c.click_report expected_counts = {'info': None, 'warn': 0, 'error': 0} self.check_results(r, expected_counts)
def test_check_peer_hooks_required(self): '''Test check_peer_hooks() - required''' c = ClickReviewDesktop(self.test_name) # create a new hooks database for our peer hooks tests tmp = dict() # add our hook tmp["desktop"] = "foo.desktop" # skip adding required hooks c.manifest["hooks"][self.default_appname] = tmp self._update_test_manifest() # do the test c.check_peer_hooks() r = c.click_report expected_counts = {'info': None, 'warn': 0, 'error': 1} self.check_results(r, expected_counts)