def test_host_labels_ps_match(): section = ( 1, [ ( ps.PsInfo.from_raw("(root,4056,1512,0.0/52-04:56:05,5689)"), ["/usr/lib/ssh/sshd"], ), ], ) params = [ { "default_params": {}, "descr": "SSH", "match": "~.*ssh?", "label": { "marco": "polo" }, }, {}, ] assert list(ps.host_labels_ps(params, section)) == [ # type: ignore[arg-type] HostLabel("marco", "polo") ]
def test_host_labels_ps_match(): section = ( 1, [ ( ps.ps_info("(root,4056,1512,0.0/52-04:56:05,5689)".split() ), # type: ignore[call-arg] ["/usr/lib/ssh/sshd"], ), ]) params = [ { "default_params": {}, "descr": "SSH", "match": "~.*ssh?", "label": { 'marco': 'polo' }, }, {}, ] assert list(ps.host_labels_ps(params, section)) == [ # type: ignore[arg-type] HostLabel('marco', 'polo') ]
def test_host_labels_ps_no_match_pattern(): section = ( 1, [ ( ps.ps_info("(root,4056,1512,0.0/52-04:56:05,5689)".split() ), # type: ignore[call-arg] ["/usr/lib/ssh/sshd"], ), ]) params = [ Parameters({ "default_params": {}, "descr": "SSH", "match": "~wat?", "label": DiscoveredHostLabels(HostLabel(u'marco', u'polo')), }), Parameters({}), ] assert list(ps.host_labels_ps(params, section)) == []
def test_host_labels_ps_no_match_pattern(): section = (1, [ ( ps.PsInfo.from_raw("(root,4056,1512,0.0/52-04:56:05,5689)"), ["/usr/lib/ssh/sshd"], ), ]) params = [ { "default_params": {}, "descr": "SSH", "match": "~wat?", "label": { 'marco': 'polo' }, }, {}, ] assert list(ps.host_labels_ps(params, section)) == [] # type: ignore[arg-type]
def test_host_labels_ps_no_match_attr(): section = ( 1, [ ( ps.ps_info("(root,4056,1512,0.0/52-04:56:05,5689)".split() ), # type: ignore[call-arg] ["/usr/lib/ssh/sshd"], ), ]) params = [ Parameters({ "default_params": {}, "descr": "SSH", "match": "~.*ssh?", "user": "******", "label": { 'marco': 'polo' }, }), Parameters({}), ] assert list(ps.host_labels_ps(params, section)) == []