github.com/crowdsecurity/crowdsec@v1.6.1/docker/test/tests/test_hub.py (about)

     1  #!/usr/bin/env python
     2  
     3  """
     4  Test pre-installed hub items.
     5  """
     6  
     7  from http import HTTPStatus
     8  import json
     9  
    10  import pytest
    11  
    12  pytestmark = pytest.mark.docker
    13  
    14  
    15  def test_preinstalled_hub(crowdsec, flavor):
    16      """Test hub objects installed in the entrypoint"""
    17      with crowdsec(flavor=flavor) as cs:
    18          cs.wait_for_log("*Starting processing data*")
    19          cs.wait_for_http(8080, '/health', want_status=HTTPStatus.OK)
    20          res = cs.cont.exec_run('cscli hub list -o json')
    21          assert res.exit_code == 0
    22          j = json.loads(res.output)
    23          collections = {c['name']: c for c in j['collections']}
    24          assert collections['crowdsecurity/linux']['status'] == 'enabled'
    25          parsers = {c['name']: c for c in j['parsers']}
    26          assert parsers['crowdsecurity/whitelists']['status'] == 'enabled'
    27          assert parsers['crowdsecurity/docker-logs']['status'] == 'enabled'