wazuh / wazuh-api

Wazuh - RESTful API
https://wazuh.com
GNU General Public License v2.0
69 stars 57 forks source link

Add 'condition' field to 'sca/:agent_id/checks/:policy_id' endpoint #453

Closed druizz90 closed 5 years ago

druizz90 commented 5 years ago

Hi team,

This PR adds the condition field to /sca/:agent_id/checks/:policy_id endpoint. I added new Mocha tests for filters in SCA endpoints too.

Mocha tests are working fine:

# mocha test/test_sca.js 

  SecurityConfigurationAssessment
    GET/sca/:agent_id
      ✓ Request (544ms)
      ✓ Pagination (422ms)
      ✓ Retrieve all elements with limit=0 (474ms)
      ✓ Sort (418ms)
      ✓ Search (433ms)
      ✓ Params: Bad agent id (99ms)
      ✓ Errors: No agent (820ms)
      ✓ Filters: Invalid filter (119ms)
      ✓ Filters: Invalid filter - Extra field (109ms)
      ✓ Filters: query (478ms)
      ✓ Filters: name (452ms)
      ✓ Filters: references (416ms)
      ✓ Retrieve all elements with limit=0 (394ms)
    GET/sca/:agent_id/checks/:policy_id
      ✓ Request (422ms)
      ✓ Pagination (430ms)
      ✓ Retrieve all elements with limit=0 (452ms)
      ✓ Sort (419ms)
      ✓ Search (622ms)
      ✓ Params: Bad agent id (124ms)
      ✓ Errors: No agent (525ms)
      ✓ Check not found (565ms)
      ✓ Retrieve all elements with limit=0 (492ms)
      ✓ Filters: description (464ms)
      ✓ Filters: remediation (409ms)
      ✓ Filters: file (419ms)
      ✓ Filters: references (437ms)
      ✓ Filters: result (410ms)
      ✓ Filters: condition (413ms)

  28 passing (12s)

Best regards,

Demetrio.