def test_check_peer_hooks_provider_disallowed(self):
        '''Test check_peer_hooks() - disallowed (provider)'''
        c = ClickReviewAccounts(self.test_name)

        # create a new hooks database for our peer hooks tests
        tmp = dict()

        # add our hook
        tmp["account-provider"] = "foo.provider"

        # add any required peer hooks
        tmp["account-qml-plugin"] = "foo.qml_plugin"
        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(["account-provider"])
        r = c.click_report
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
        self.check_results(r, expected_counts)
    def test_check_peer_hooks_provider_required(self):
        '''Test check_peer_hooks() - required (provider)'''
        c = ClickReviewAccounts(self.test_name)

        # create a new hooks database for our peer hooks tests
        tmp = dict()

        # add our hook
        tmp["account-provider"] = "foo.provider"

        # skip adding required hooks

        c.manifest["hooks"][self.default_appname] = tmp
        self._update_test_manifest()

        # do the test
        c.check_peer_hooks(["account-provider"])
        r = c.click_report
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
        self.check_results(r, expected_counts)
    def test_check_peer_hooks_application(self):
        '''Test check_peer_hooks() - application'''
        c = ClickReviewAccounts(self.test_name)

        # create a new hooks database for our peer hooks tests
        tmp = dict()

        # add our hook
        tmp["account-application"] = "foo.application"

        # add any required peer hooks
        tmp["apparmor"] = "foo.apparmor"

        # update the manifest and test_manifest
        c.manifest["hooks"][self.default_appname] = tmp
        self._update_test_manifest()

        # do the test
        c.check_peer_hooks(["account-application"])
        r = c.click_report
        # We should end up with 8 info
        expected_counts = {'info': 2, 'warn': 0, 'error': 0}
        self.check_results(r, expected_counts)