Beispiel #1
0
 def _get_base_query(self):
     try:
         confirmed = bool(json.loads(flask.request.args['confirmed']))
     except (KeyError, ValueError):
         confirmed = None
     try:
         active = bool(json.loads(flask.request.args['active']))
         query = Workspace.query_with_count(confirmed).filter(self.model_class.active == active)
     except (KeyError, ValueError):
         query = Workspace.query_with_count(confirmed)
     return query
Beispiel #2
0
 def _get_base_query(self):
     try:
         confirmed = bool(json.loads(flask.request.args['confirmed']))
     except (KeyError, ValueError):
         confirmed = None
     try:
         active = bool(json.loads(flask.request.args['active']))
         query = Workspace.query_with_count(confirmed).filter(
             self.model_class.active == active)
     except (KeyError, ValueError):
         query = Workspace.query_with_count(confirmed)
     return query
Beispiel #3
0
 def _get_base_query(self, object_id=None):
     try:
         confirmed = bool(json.loads(flask.request.args['confirmed']))
     except (KeyError, ValueError):
         confirmed = None
     try:
         active = bool(json.loads(flask.request.args['active']))
         query = Workspace.query_with_count(
                 confirmed,
                 active=active,
                 workspace_name=object_id)
     except (KeyError, ValueError):
         query = Workspace.query_with_count(
                 confirmed,
                 workspace_name=object_id)
     return query
Beispiel #4
0
 def _get_base_query(self, object_id=None):
     confirmed = self._get_querystring_boolean_field('confirmed')
     active = self._get_querystring_boolean_field('active')
     readonly = self._get_querystring_boolean_field('readonly')
     query = Workspace.query_with_count(confirmed,
                                        active=active,
                                        readonly=readonly,
                                        workspace_name=object_id)
     return query
Beispiel #5
0
 def _get_base_query(self, object_id=None):
     confirmed = self._get_querystring_boolean_field('confirmed')
     active = self._get_querystring_boolean_field('active')
     readonly = self._get_querystring_boolean_field('readonly')
     query = Workspace.query_with_count(
             confirmed,
             active=active,
             readonly=readonly,
             workspace_name=object_id)
     return query
def test_vuln_count(workspace, second_workspace):
    populate_workspace(workspace)
    populate_workspace(second_workspace)
    workspace = Workspace.query_with_count(False).filter(
        Workspace.id == workspace.id).first()
    assert workspace.vulnerability_web_count == WEB_VULN_COUNT
    assert workspace.vulnerability_code_count == SOURCE_CODE_VULN_COUNT
    assert workspace.vulnerability_standard_count == sum(STANDARD_VULN_COUNT)
    assert workspace.vulnerability_total_count == (sum(STANDARD_VULN_COUNT) +
                                                   WEB_VULN_COUNT +
                                                   SOURCE_CODE_VULN_COUNT)
Beispiel #7
0
def test_vuln_count_confirmed(workspace, second_workspace):
    populate_workspace(workspace)
    populate_workspace(second_workspace)
    workspace = Workspace.query_with_count(True).filter(
        Workspace.id == workspace.id).first()
    assert workspace.vulnerability_web_count == C_WEB_VULN_COUNT
    assert workspace.vulnerability_code_count == C_SOURCE_CODE_VULN_COUNT
    assert workspace.vulnerability_standard_count == sum(
        C_STANDARD_VULN_COUNT)
    assert workspace.vulnerability_total_count == (
        sum(C_STANDARD_VULN_COUNT) + C_WEB_VULN_COUNT +
        C_SOURCE_CODE_VULN_COUNT
    )
Beispiel #8
0
def test_vuln_count(workspace, second_workspace, database):
    if database.engine.dialect.name == 'sqlite':
        return
    populate_workspace(workspace)
    populate_workspace(second_workspace)
    workspace = Workspace.query_with_count(None, workspace_name=workspace.name).fetchone()
    assert workspace['vulnerability_web_count'] == WEB_VULN_COUNT
    assert workspace['vulnerability_code_count'] == SOURCE_CODE_VULN_COUNT
    assert workspace['vulnerability_standard_count'] == sum(
        STANDARD_VULN_COUNT)
    assert workspace['vulnerability_total_count'] == (
        sum(STANDARD_VULN_COUNT) + WEB_VULN_COUNT +
        SOURCE_CODE_VULN_COUNT
    )
Beispiel #9
0
 def _get_base_query(self):
     try:
         only_confirmed = bool(json.loads(flask.request.args['confirmed']))
     except (KeyError, ValueError):
         only_confirmed = False
     return Workspace.query_with_count(only_confirmed)