~jdstrand/click-reviewers-tools/migrate-from-skill-to-interfaces

« back to all changes in this revision

Viewing changes to clickreviews/tests/test_sr_lint.py

  • Committer: Jamie Strandboge
  • Date: 2016-02-24 18:22:42 UTC
  • Revision ID: jamie@ubuntu.com-20160224182242-3pzpwbbuy14az7s0
migrate skills to interfaces

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
                 }
43
43
        return ports
44
44
 
45
 
    def _create_top_uses(self):
46
 
        uses = {'skill-caps': {'type': 'migration-skill',
47
 
                               'caps': ['network-client']},
48
 
                'skill-override': {'type': 'migration-skill',
49
 
                                   'security-override': {"read_path": "/foo/",
50
 
                                                         "seccomp": "abc"}},
51
 
                'skill-policy': {'type': 'migration-skill',
52
 
                                 'security-policy': {"apparmor": "meta/aa",
53
 
                                                     "seccomp": "meta/sc"}},
54
 
                'skill-template': {'type': 'migration-skill',
55
 
                                   'security-template': "unconfined"}
56
 
                }
57
 
        return uses
58
 
 
59
 
    def _create_apps_uses(self):
60
 
        uses = {'app1': {'uses': ['skill-caps']},
61
 
                'app2': {'uses': ['skill-caps', 'skill-template']},
62
 
                'app3': {'uses': ['skill-template', 'skill-override']},
63
 
                'app4': {'uses': ['skill-policy']},
64
 
                }
65
 
        return uses
 
45
    def _create_top_slots(self):
 
46
        slots = {'iface-caps': {'interface': 'old-security',
 
47
                                'caps': ['network-client']},
 
48
                 'iface-override': {'interface': 'old-security',
 
49
                                    'security-override': {"read_path": "/foo/",
 
50
                                                          "seccomp": "abc"}},
 
51
                 'iface-policy': {'interface': 'old-security',
 
52
                                  'security-policy': {"apparmor": "meta/aa",
 
53
                                                      "seccomp": "meta/sc"}},
 
54
                 'iface-template': {'interface': 'old-security',
 
55
                                    'security-template': "unconfined"}
 
56
                 }
 
57
        return slots
 
58
 
 
59
    def _create_apps_slots(self):
 
60
        slots = {'app1': {'slots': ['iface-caps']},
 
61
                 'app2': {'slots': ['iface-caps', 'iface-template']},
 
62
                 'app3': {'slots': ['iface-template', 'iface-override']},
 
63
                 'app4': {'slots': ['iface-policy']},
 
64
                 }
 
65
        return slots
 
66
 
 
67
    def _create_top_plugs(self):
 
68
        plugs = {'iface-plug1': {'interface': 'bool-type'}}  # TODO
 
69
        return plugs
 
70
 
 
71
    def _create_apps_plugs(self):
 
72
        plugs = {'app1': {'plugs': ['iface-plug1']}}  # TODO
 
73
        return plugs
66
74
 
67
75
    def patch_frameworks(self):
68
76
        def _mock_frameworks(self, overrides=None):
1196
1204
        expected_counts = {'info': 1, 'warn': 0, 'error': 0}
1197
1205
        self.check_results(r, expected_counts)
1198
1206
 
1199
 
    def test_check_apps_nondaemon_uses(self):
1200
 
        '''Test check_apps_nondaemon() - uses'''
 
1207
    def test_check_apps_nondaemon_slots(self):
 
1208
        '''Test check_apps_nondaemon() - slots'''
1201
1209
        self.set_test_snap_yaml("apps", {"foo": {"command": "bin/bar",
1202
 
                                                 "uses": {}}})
 
1210
                                                 "slots": {}}})
1203
1211
        c = SnapReviewLint(self.test_name)
1204
1212
        c.check_apps_nondaemon()
1205
1213
        r = c.click_report
2070
2078
        expected_counts = {'info': 0, 'warn': 0, 'error': 0}
2071
2079
        self.check_results(r, expected_counts)
2072
2080
 
2073
 
    def test_check_uses(self):
2074
 
        '''Test check_uses()'''
2075
 
        uses = self._create_top_uses()
2076
 
        self.set_test_snap_yaml("uses", uses)
 
2081
    def test_check_slots(self):
 
2082
        '''Test check_slots()'''
 
2083
        slots = self._create_top_slots()
 
2084
        self.set_test_snap_yaml("slots", slots)
2077
2085
        c = SnapReviewLint(self.test_name)
2078
 
        c.check_uses()
 
2086
        c.check_slots()
2079
2087
        r = c.click_report
2080
2088
        expected_counts = {'info': 13, 'warn': 0, 'error': 0}
2081
2089
        self.check_results(r, expected_counts)
2082
2090
 
2083
 
    def test_check_uses_bad_type(self):
2084
 
        '''Test check_uses() - bad type (list)'''
2085
 
        uses = {'skill-caps': {'type': [],
2086
 
                               'caps': ['network-client']}}
2087
 
        self.set_test_snap_yaml("uses", uses)
2088
 
        c = SnapReviewLint(self.test_name)
2089
 
        c.check_uses()
2090
 
        r = c.click_report
2091
 
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
2092
 
        self.check_results(r, expected_counts)
2093
 
 
2094
 
    def test_check_uses_empty_type(self):
2095
 
        '''Test check_uses() - empty type'''
2096
 
        uses = {'skill-caps': {'type': "",
2097
 
                               'caps': ['network-client']}}
2098
 
        self.set_test_snap_yaml("uses", uses)
2099
 
        c = SnapReviewLint(self.test_name)
2100
 
        c.check_uses()
2101
 
        r = c.click_report
2102
 
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
2103
 
        self.check_results(r, expected_counts)
2104
 
 
2105
 
    def test_check_uses_unspecified_type(self):
2106
 
        '''Test check_uses() - unspecified type'''
2107
 
        uses = {'migration-skill': {'caps': ['network-client']}}
2108
 
        self.set_test_snap_yaml("uses", uses)
2109
 
        c = SnapReviewLint(self.test_name)
2110
 
        c.check_uses()
 
2091
    def test_check_slots_bad_interface(self):
 
2092
        '''Test check_slots() - bad interface (list)'''
 
2093
        slots = {'iface-caps': {'interface': [],
 
2094
                                'caps': ['network-client']}}
 
2095
        self.set_test_snap_yaml("slots", slots)
 
2096
        c = SnapReviewLint(self.test_name)
 
2097
        c.check_slots()
 
2098
        r = c.click_report
 
2099
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
 
2100
        self.check_results(r, expected_counts)
 
2101
 
 
2102
    def test_check_slots_empty_interface(self):
 
2103
        '''Test check_slots() - empty interface'''
 
2104
        slots = {'iface-caps': {'interface': "",
 
2105
                                'caps': ['network-client']}}
 
2106
        self.set_test_snap_yaml("slots", slots)
 
2107
        c = SnapReviewLint(self.test_name)
 
2108
        c.check_slots()
 
2109
        r = c.click_report
 
2110
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
 
2111
        self.check_results(r, expected_counts)
 
2112
 
 
2113
    def test_check_slots_unspecified_interface(self):
 
2114
        '''Test check_slots() - unspecified interface'''
 
2115
        slots = {'old-security': {'caps': ['network-client']}}
 
2116
        self.set_test_snap_yaml("slots", slots)
 
2117
        c = SnapReviewLint(self.test_name)
 
2118
        c.check_slots()
2111
2119
        r = c.click_report
2112
2120
        expected_counts = {'info': 3, 'warn': 0, 'error': 0}
2113
2121
        self.check_results(r, expected_counts)
2114
2122
 
2115
 
    def test_check_uses_unknown_type(self):
2116
 
        '''Test check_uses() - type (unknown)'''
2117
 
        uses = {'skill-caps': {'type': 'nonexistent',
2118
 
                               'caps': ['network-client']}}
2119
 
        self.set_test_snap_yaml("uses", uses)
2120
 
        c = SnapReviewLint(self.test_name)
2121
 
        c.check_uses()
2122
 
        r = c.click_report
2123
 
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
2124
 
        self.check_results(r, expected_counts)
2125
 
 
2126
 
    def test_check_uses_unspecified_unknown_type(self):
2127
 
        '''Test check_uses() - unspecified type (unknown)'''
2128
 
        uses = {'nonexistent': {'caps': ['network-client']}}
2129
 
        self.set_test_snap_yaml("uses", uses)
2130
 
        c = SnapReviewLint(self.test_name)
2131
 
        c.check_uses()
2132
 
        r = c.click_report
2133
 
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
2134
 
        self.check_results(r, expected_counts)
2135
 
 
2136
 
    def test_check_uses_missing_attrib(self):
2137
 
        '''Test check_uses() - missing attrib'''
2138
 
        uses = {'migration-skill': {}}
2139
 
        self.set_test_snap_yaml("uses", uses)
2140
 
        c = SnapReviewLint(self.test_name)
2141
 
        c.check_uses()
2142
 
        r = c.click_report
2143
 
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
2144
 
        self.check_results(r, expected_counts)
2145
 
 
2146
 
    def test_check_uses_missing_attrib_explicit_type(self):
2147
 
        '''Test check_uses() - missing attrib'''
2148
 
        uses = {'skill-caps': {'type': 'migration-skill'}}
2149
 
        self.set_test_snap_yaml("uses", uses)
2150
 
        c = SnapReviewLint(self.test_name)
2151
 
        c.check_uses()
2152
 
        r = c.click_report
2153
 
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
2154
 
        self.check_results(r, expected_counts)
2155
 
 
2156
 
    def test_check_uses_unknown_attrib(self):
2157
 
        '''Test check_uses() - unknown attrib'''
2158
 
        uses = {'skill-caps': {'type': "migration-skill",
2159
 
                               'nonexistent': 'abc'}}
2160
 
        self.set_test_snap_yaml("uses", uses)
2161
 
        c = SnapReviewLint(self.test_name)
2162
 
        c.check_uses()
2163
 
        r = c.click_report
2164
 
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
2165
 
        self.check_results(r, expected_counts)
2166
 
 
2167
 
    def test_check_uses_bad_attrib_caps(self):
2168
 
        '''Test check_uses() - bad attrib - caps'''
2169
 
        uses = {'skill-caps': {'type': "migration-skill",
2170
 
                               'caps': 'bad'}}
2171
 
        self.set_test_snap_yaml("uses", uses)
2172
 
        c = SnapReviewLint(self.test_name)
2173
 
        c.check_uses()
2174
 
        r = c.click_report
2175
 
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
2176
 
        self.check_results(r, expected_counts)
2177
 
 
2178
 
    def test_check_uses_bad_attrib_security_override(self):
2179
 
        '''Test check_uses() - bad attrib - security-override'''
2180
 
        uses = {'skill-caps': {'type': "migration-skill",
2181
 
                               'security-override': 'bad'}}
2182
 
        self.set_test_snap_yaml("uses", uses)
2183
 
        c = SnapReviewLint(self.test_name)
2184
 
        c.check_uses()
2185
 
        r = c.click_report
2186
 
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
2187
 
        self.check_results(r, expected_counts)
2188
 
 
2189
 
    def test_check_uses_bad_attrib_security_policy(self):
2190
 
        '''Test check_uses() - bad attrib - security-policy'''
2191
 
        uses = {'skill-caps': {'type': "migration-skill",
2192
 
                               'security-policy': 'bad'}}
2193
 
        self.set_test_snap_yaml("uses", uses)
2194
 
        c = SnapReviewLint(self.test_name)
2195
 
        c.check_uses()
2196
 
        r = c.click_report
2197
 
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
2198
 
        self.check_results(r, expected_counts)
2199
 
 
2200
 
    def test_check_uses_bad_attrib_security_template(self):
2201
 
        '''Test check_uses() - bad attrib - security-template'''
2202
 
        uses = {'skill-caps': {'type': "migration-skill",
2203
 
                               'security-template': []}}
2204
 
        self.set_test_snap_yaml("uses", uses)
2205
 
        c = SnapReviewLint(self.test_name)
2206
 
        c.check_uses()
2207
 
        r = c.click_report
2208
 
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
2209
 
        self.check_results(r, expected_counts)
2210
 
 
2211
 
    def test_check_apps_uses(self):
2212
 
        '''Test check_apps_uses()'''
2213
 
        uses = self._create_top_uses()
2214
 
        apps_uses = self._create_apps_uses()
2215
 
        self.set_test_snap_yaml("uses", uses)
2216
 
        self.set_test_snap_yaml("apps", apps_uses)
2217
 
        c = SnapReviewLint(self.test_name)
2218
 
        c.check_apps_uses()
 
2123
    def test_check_slots_unknown_interface(self):
 
2124
        '''Test check_slots() - interface (unknown)'''
 
2125
        slots = {'iface-caps': {'interface': 'nonexistent',
 
2126
                                'caps': ['network-client']}}
 
2127
        self.set_test_snap_yaml("slots", slots)
 
2128
        c = SnapReviewLint(self.test_name)
 
2129
        c.check_slots()
 
2130
        r = c.click_report
 
2131
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
 
2132
        self.check_results(r, expected_counts)
 
2133
 
 
2134
    def test_check_slots_unspecified_unknown_interface(self):
 
2135
        '''Test check_slots() - unspecified interface (unknown)'''
 
2136
        slots = {'nonexistent': {'caps': ['network-client']}}
 
2137
        self.set_test_snap_yaml("slots", slots)
 
2138
        c = SnapReviewLint(self.test_name)
 
2139
        c.check_slots()
 
2140
        r = c.click_report
 
2141
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
 
2142
        self.check_results(r, expected_counts)
 
2143
 
 
2144
    def test_check_slots_missing_attrib(self):
 
2145
        '''Test check_slots() - missing attrib'''
 
2146
        slots = {'old-security': {}}
 
2147
        self.set_test_snap_yaml("slots", slots)
 
2148
        c = SnapReviewLint(self.test_name)
 
2149
        c.check_slots()
 
2150
        r = c.click_report
 
2151
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
 
2152
        self.check_results(r, expected_counts)
 
2153
 
 
2154
    def test_check_slots_missing_attrib_explicit_interface(self):
 
2155
        '''Test check_slots() - missing attrib'''
 
2156
        slots = {'iface-caps': {'interface': 'old-security'}}
 
2157
        self.set_test_snap_yaml("slots", slots)
 
2158
        c = SnapReviewLint(self.test_name)
 
2159
        c.check_slots()
 
2160
        r = c.click_report
 
2161
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
 
2162
        self.check_results(r, expected_counts)
 
2163
 
 
2164
    def test_check_slots_unknown_attrib(self):
 
2165
        '''Test check_slots() - unknown attrib'''
 
2166
        slots = {'iface-caps': {'interface': 'old-security',
 
2167
                                'nonexistent': 'abc'}}
 
2168
        self.set_test_snap_yaml("slots", slots)
 
2169
        c = SnapReviewLint(self.test_name)
 
2170
        c.check_slots()
 
2171
        r = c.click_report
 
2172
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
 
2173
        self.check_results(r, expected_counts)
 
2174
 
 
2175
    def test_check_slots_bad_attrib_caps(self):
 
2176
        '''Test check_slots() - bad attrib - caps'''
 
2177
        slots = {'iface-caps': {'interface': 'old-security',
 
2178
                                'caps': 'bad'}}
 
2179
        self.set_test_snap_yaml("slots", slots)
 
2180
        c = SnapReviewLint(self.test_name)
 
2181
        c.check_slots()
 
2182
        r = c.click_report
 
2183
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
 
2184
        self.check_results(r, expected_counts)
 
2185
 
 
2186
    def test_check_slots_bad_attrib_security_override(self):
 
2187
        '''Test check_slots() - bad attrib - security-override'''
 
2188
        slots = {'iface-caps': {'interface': 'old-security',
 
2189
                                'security-override': 'bad'}}
 
2190
        self.set_test_snap_yaml("slots", slots)
 
2191
        c = SnapReviewLint(self.test_name)
 
2192
        c.check_slots()
 
2193
        r = c.click_report
 
2194
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
 
2195
        self.check_results(r, expected_counts)
 
2196
 
 
2197
    def test_check_slots_bad_attrib_security_policy(self):
 
2198
        '''Test check_slots() - bad attrib - security-policy'''
 
2199
        slots = {'iface-caps': {'interface': 'old-security',
 
2200
                                'security-policy': 'bad'}}
 
2201
        self.set_test_snap_yaml("slots", slots)
 
2202
        c = SnapReviewLint(self.test_name)
 
2203
        c.check_slots()
 
2204
        r = c.click_report
 
2205
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
 
2206
        self.check_results(r, expected_counts)
 
2207
 
 
2208
    def test_check_slots_bad_attrib_security_template(self):
 
2209
        '''Test check_slots() - bad attrib - security-template'''
 
2210
        slots = {'iface-caps': {'interface': 'old-security',
 
2211
                                'security-template': []}}
 
2212
        self.set_test_snap_yaml("slots", slots)
 
2213
        c = SnapReviewLint(self.test_name)
 
2214
        c.check_slots()
 
2215
        r = c.click_report
 
2216
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
 
2217
        self.check_results(r, expected_counts)
 
2218
 
 
2219
    def test_check_apps_slots(self):
 
2220
        '''Test check_apps_slots()'''
 
2221
        slots = self._create_top_slots()
 
2222
        apps_slots = self._create_apps_slots()
 
2223
        self.set_test_snap_yaml("slots", slots)
 
2224
        self.set_test_snap_yaml("apps", apps_slots)
 
2225
        c = SnapReviewLint(self.test_name)
 
2226
        c.check_apps_slots()
2219
2227
        r = c.click_report
2220
2228
        expected_counts = {'info': 10, 'warn': 0, 'error': 0}
2221
2229
        self.check_results(r, expected_counts)
2222
2230
 
2223
 
    def test_check_apps_no_uses(self):
2224
 
        '''Test check_apps_uses() - no uses'''
2225
 
        uses = self._create_top_uses()
2226
 
        apps_uses = {'bar': {'command': 'bin/bar'}}
2227
 
        self.set_test_snap_yaml("uses", uses)
2228
 
        self.set_test_snap_yaml("apps", apps_uses)
 
2231
    def test_check_apps_no_slots(self):
 
2232
        '''Test check_apps_slots() - no slots'''
 
2233
        slots = self._create_top_slots()
 
2234
        apps_slots = {'bar': {'command': 'bin/bar'}}
 
2235
        self.set_test_snap_yaml("slots", slots)
 
2236
        self.set_test_snap_yaml("apps", apps_slots)
2229
2237
        c = SnapReviewLint(self.test_name)
2230
 
        c.check_apps_uses()
 
2238
        c.check_apps_slots()
2231
2239
        r = c.click_report
2232
2240
        expected_counts = {'info': 0, 'warn': 0, 'error': 0}
2233
2241
        self.check_results(r, expected_counts)
2234
2242
 
2235
 
    def test_check_apps_uses_bad(self):
2236
 
        '''Test check_apps_uses() - bad (dict)'''
2237
 
        uses = self._create_top_uses()
2238
 
        apps_uses = {'bar': {'uses': {}}}
2239
 
        self.set_test_snap_yaml("uses", uses)
2240
 
        self.set_test_snap_yaml("apps", apps_uses)
2241
 
        c = SnapReviewLint(self.test_name)
2242
 
        c.check_apps_uses()
2243
 
        r = c.click_report
2244
 
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
2245
 
        self.check_results(r, expected_counts)
2246
 
 
2247
 
    def test_check_apps_uses_empty(self):
2248
 
        '''Test check_apps_uses() - empty'''
2249
 
        uses = self._create_top_uses()
2250
 
        apps_uses = {'bar': {'uses': []}}
2251
 
        self.set_test_snap_yaml("uses", uses)
2252
 
        self.set_test_snap_yaml("apps", apps_uses)
2253
 
        c = SnapReviewLint(self.test_name)
2254
 
        c.check_apps_uses()
2255
 
        r = c.click_report
2256
 
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
2257
 
        self.check_results(r, expected_counts)
2258
 
 
2259
 
    def test_check_apps_uses_bad_entry(self):
2260
 
        '''Test check_apps_uses() - bad entry (dict)'''
2261
 
        uses = self._create_top_uses()
2262
 
        apps_uses = {'bar': {'uses': [{}]}}
2263
 
        self.set_test_snap_yaml("uses", uses)
2264
 
        self.set_test_snap_yaml("apps", apps_uses)
2265
 
        c = SnapReviewLint(self.test_name)
2266
 
        c.check_apps_uses()
2267
 
        r = c.click_report
2268
 
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
2269
 
        self.check_results(r, expected_counts)
2270
 
 
2271
 
    def test_check_apps_uses_unknown_entry(self):
2272
 
        '''Test check_apps_uses() - unknown'''
2273
 
        uses = self._create_top_uses()
2274
 
        apps_uses = {'bar': {'uses': ['nonexistent']}}
2275
 
        self.set_test_snap_yaml("uses", uses)
2276
 
        self.set_test_snap_yaml("apps", apps_uses)
2277
 
        c = SnapReviewLint(self.test_name)
2278
 
        c.check_apps_uses()
2279
 
        r = c.click_report
2280
 
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
 
2243
    def test_check_apps_slots_bad(self):
 
2244
        '''Test check_apps_slots() - bad (dict)'''
 
2245
        slots = self._create_top_slots()
 
2246
        apps_slots = {'bar': {'slots': {}}}
 
2247
        self.set_test_snap_yaml("slots", slots)
 
2248
        self.set_test_snap_yaml("apps", apps_slots)
 
2249
        c = SnapReviewLint(self.test_name)
 
2250
        c.check_apps_slots()
 
2251
        r = c.click_report
 
2252
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
 
2253
        self.check_results(r, expected_counts)
 
2254
 
 
2255
    def test_check_apps_slots_empty(self):
 
2256
        '''Test check_apps_slots() - empty'''
 
2257
        slots = self._create_top_slots()
 
2258
        apps_slots = {'bar': {'slots': []}}
 
2259
        self.set_test_snap_yaml("slots", slots)
 
2260
        self.set_test_snap_yaml("apps", apps_slots)
 
2261
        c = SnapReviewLint(self.test_name)
 
2262
        c.check_apps_slots()
 
2263
        r = c.click_report
 
2264
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
 
2265
        self.check_results(r, expected_counts)
 
2266
 
 
2267
    def test_check_apps_slots_bad_entry(self):
 
2268
        '''Test check_apps_slots() - bad entry (dict)'''
 
2269
        slots = self._create_top_slots()
 
2270
        apps_slots = {'bar': {'slots': [{}]}}
 
2271
        self.set_test_snap_yaml("slots", slots)
 
2272
        self.set_test_snap_yaml("apps", apps_slots)
 
2273
        c = SnapReviewLint(self.test_name)
 
2274
        c.check_apps_slots()
 
2275
        r = c.click_report
 
2276
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
 
2277
        self.check_results(r, expected_counts)
 
2278
 
 
2279
    def test_check_apps_slots_unknown_entry(self):
 
2280
        '''Test check_apps_slots() - unknown'''
 
2281
        slots = self._create_top_slots()
 
2282
        apps_slots = {'bar': {'slots': ['nonexistent']}}
 
2283
        self.set_test_snap_yaml("slots", slots)
 
2284
        self.set_test_snap_yaml("apps", apps_slots)
 
2285
        c = SnapReviewLint(self.test_name)
 
2286
        c.check_apps_slots()
 
2287
        r = c.click_report
 
2288
        expected_counts = {'info': None, 'warn': 0, 'error': 1}
 
2289
        self.check_results(r, expected_counts)
 
2290
 
 
2291
    def test_check_plugs(self):
 
2292
        '''Test check_plugs()'''
 
2293
        plugs = self._create_top_plugs()
 
2294
        self.set_test_snap_yaml("plugs", plugs)
 
2295
        c = SnapReviewLint(self.test_name)
 
2296
        c.check_plugs()
 
2297
        r = c.click_report
 
2298
        expected_counts = {'info': 0, 'warn': 1, 'error': 0}
 
2299
        self.check_results(r, expected_counts)
 
2300
 
 
2301
    def test_check_apps_plugs(self):
 
2302
        '''Test check_apps_plugs()'''
 
2303
        plugs = self._create_top_plugs()
 
2304
        self.set_test_snap_yaml("plugs", plugs)
 
2305
        apps_plugs = self._create_apps_plugs()
 
2306
        self.set_test_snap_yaml("apps", apps_plugs)
 
2307
        c = SnapReviewLint(self.test_name)
 
2308
        c.check_apps_plugs()
 
2309
        r = c.click_report
 
2310
        expected_counts = {'info': 0, 'warn': 1, 'error': 0}
2281
2311
        self.check_results(r, expected_counts)
2282
2312
 
2283
2313