def test_snappy_framework_policy_metadata(self):
     '''Test check_snappy_framework_policy_metadata()'''
     self.set_test_pkg_yaml("type", "framework")
     c = ClickReviewFramework(self.test_name)
     c.check_snappy_framework_policy_metadata()
     r = c.click_report
     expected_counts = {'info': 1, 'warn': 0, 'error': 0}
     self.check_results(r, expected_counts)
 def test_snappy_framework_depends_bad(self):
     '''Test check_snappy_framework_depends() - bad'''
     self.set_test_pkg_yaml("type", "framework")
     self.set_test_pkg_yaml("frameworks", ['foo'])
     c = ClickReviewFramework(self.test_name)
     c.check_snappy_framework_depends()
     r = c.click_report
     expected_counts = {'info': 0, 'warn': 0, 'error': 1}
     self.check_results(r, expected_counts)
 def test_snappy_framework_policy_unknown(self):
     '''Test check_snappy_framework_policy() - unknown'''
     self.set_test_pkg_yaml("type", "framework")
     self.set_test_framework_policy_unknown(['foo/bar/baz'])
     c = ClickReviewFramework(self.test_name)
     c.check_snappy_framework_policy()
     r = c.click_report
     expected_counts = {'info': None, 'warn': 1, 'error': 0}
     self.check_results(r, expected_counts)
    def test_framework_hook_obsolete(self):
        '''Test check_framework_hook_obsolete()'''
        self.set_test_framework(self.default_appname, "", "")
        c = ClickReviewFramework(self.test_name)

        c.check_framework_hook_obsolete()
        r = c.click_report
        expected_counts = {'info': 0, 'warn': 0, 'error': 1}
        self.check_results(r, expected_counts)
 def test_snappy_framework_policy_filenames_bad(self):
     '''Test check_snappy_framework_policy_filenames() - bad name'''
     self.set_test_pkg_yaml("type", "framework")
     tmp = self.test_framework_policy
     tmp['seccomp']['policygroups']['policygroup-res_erved'] = "foo"
     self.set_test_framework_policy(tmp)
     c = ClickReviewFramework(self.test_name)
     c.check_snappy_framework_policy_filenames()
     r = c.click_report
     expected_counts = {'info': None, 'warn': 0, 'error': 1}
     self.check_results(r, expected_counts)
 def test_snappy_framework_policy_matching_missing_aa_template(self):
     '''Test check_snappy_framework_policy_matching() - missing aa template
     '''
     self.set_test_pkg_yaml("type", "framework")
     tmp = self.test_framework_policy
     del tmp['apparmor']['templates']['template-common']
     self.set_test_framework_policy(tmp)
     c = ClickReviewFramework(self.test_name)
     c.check_snappy_framework_policy_matching()
     r = c.click_report
     expected_counts = {'info': None, 'warn': 0, 'error': 1}
     self.check_results(r, expected_counts)
 def test_snappy_framework_policy_matching_missing_sc_policygroup(self):
     '''Test check_snappy_framework_policy_matching() - missing sc policy
        group
     '''
     self.set_test_pkg_yaml("type", "framework")
     tmp = self.test_framework_policy
     del tmp['seccomp']['policygroups']['policygroup-reserved']
     self.set_test_framework_policy(tmp)
     c = ClickReviewFramework(self.test_name)
     c.check_snappy_framework_policy_matching()
     r = c.click_report
     expected_counts = {'info': None, 'warn': 0, 'error': 1}
     self.check_results(r, expected_counts)
 def test_snappy_framework_policy_filenames_bad2(self):
     '''Test check_snappy_framework_policy_filenames() - starts with
        package name
     '''
     self.set_test_pkg_yaml("type", "framework")
     tmp = self.test_framework_policy
     n = self.test_name.split('_')[0]
     tmp['seccomp']['policygroups']['%s-group' % n] = "foo"
     self.set_test_framework_policy(tmp)
     c = ClickReviewFramework(self.test_name)
     c.check_snappy_framework_policy_filenames()
     r = c.click_report
     expected_counts = {'info': None, 'warn': 1, 'error': 0}
     self.check_results(r, expected_counts)