def test_catchall_versions_are_ignored_for_nonpreferred_resources():
    resource = Resource(
        group='group1', version='version1', preferred=False,
        plural='plural1', singular='singular1', kind='kind1',
        shortcuts=['shortcut1', 'shortcut2'],
        categories=['category1', 'category2'],
    )
    selector = Selector(EVERYTHING)
    matches = selector.check(resource)
    assert not matches
def test_when_groupversion_mismatch_but_names_do_match(resource, kwarg, kwval, group, version):
    selector = Selector(group=group, version=version, **{kwarg: kwval})
    matches = selector.check(resource)
    assert not matches
def test_when_matches_names(resource, kwarg, kwval, group, version):
    selector = Selector(group=group, version=version, **{kwarg: kwval})
    matches = selector.check(resource)
    assert matches
def test_when_matches_everything(resource, group, version):
    selector = Selector(EVERYTHING, group=group, version=version)
    matches = selector.check(resource)
    assert matches
def test_events_are_excluded_from_everything(resource_kwargs, selector_args):
    resource = Resource(**resource_kwargs, plural='events')
    selector = Selector(*selector_args)
    matches = selector.check(resource)
    assert not matches
def test_events_are_matched_when_explicitly_named(selector_args):
    resource = Resource('', 'v1', 'events')
    selector = Selector(*selector_args)
    matches = selector.check(resource)
    assert matches