Beispiel #1
0
    def test_query_response_bad_return_code(mock_query_response):
        config = {
            "auth": {
                "username": "******",
                "password": "******"
            }
        }

        connection = {
            "host": "123.123.123.123",
            "port": 443,
            "selfSignedCert": False,
        }

        big_fix_return_value = 'big fix did not return proper value'
        mocked_return_value = MockHttpResponse(big_fix_return_value)
        mock_query_response.return_value = BigFixMockHttpXMLResponse(200, mocked_return_value)
        
        query = 'bigfix query text'

        entry_point = EntryPoint(connection, config)
        query_response = entry_point.create_query_connection(query)

        assert query_response is not None
        assert 'success' in query_response
        assert query_response['success'] is False
        assert 'error' in query_response
Beispiel #2
0
    def test_delete_query():
        search_id = "104"

        entry_point = EntryPoint(CONNECTION, CONFIG)
        status_response = entry_point.delete_query_connection(search_id)
        assert status_response is not None
        assert 'success' in status_response
        assert status_response['success'] is True
Beispiel #3
0
    def test_query_response_bad_return_code(mock_query_response):
        big_fix_return_value = 'big fix did not return proper value'
        mocked_return_value = MockHttpResponse(big_fix_return_value)
        mock_query_response.return_value = BigFixMockHttpXMLResponse(
            200, mocked_return_value)

        query = 'bigfix query text'

        entry_point = EntryPoint(CONNECTION, CONFIG)
        query_response = entry_point.create_query_connection(query)

        assert query_response is not None
        assert 'success' in query_response
        assert query_response['success'] is False
        assert 'error' in query_response
import json
from stix_shifter_utils.stix_translation.src.utils import transformers
from stix_shifter_utils.stix_translation.src.json_to_stix import json_to_stix_translator
from stix_shifter_modules.bigfix.entry_point import EntryPoint
import unittest

entry_point = EntryPoint()
map_file = open(entry_point.get_results_translator().default_mapping_file_path).read()
map_data = json.loads(map_file)
data_source = {
    "type": "identity",
    "id": "identity--3532c56d-ea72-48be-a2ad-1a53f4c9c6d3",
    "name": "BigFix",
    "identity_class": "events"
}
options = {}


class TestBigFixResultsToStix(unittest.TestCase):
    """
    class to perform unit test case for bigfix translate results
    """

    @staticmethod
    def get_first(itr, constraint):
        """
        return the obj in the itr if constraint is true
        """
        return next(
            (obj for obj in itr if constraint(obj)),
            None
Beispiel #5
0
    def test_is_async():
        entry_point = EntryPoint(CONNECTION, CONFIG)

        check_async = entry_point.is_async()
        assert check_async
import unittest
from stix_shifter_utils.stix_translation.src.json_to_stix import json_to_stix_translator
from stix_shifter_modules.bigfix.entry_point import EntryPoint
from stix_shifter_utils.stix_translation.src.utils.transformer_utils import get_module_transformers

MODULE = "bigfix"
entry_point = EntryPoint()
map_data = entry_point.get_results_translator().map_data
data_source = {
    "type": "identity",
    "id": "identity--3532c56d-ea72-48be-a2ad-1a53f4c9c6d3",
    "name": "BigFix",
    "identity_class": "events"
}
options = {}


class TestBigFixResultsToStix(unittest.TestCase):
    """
    class to perform unit test case for bigfix translate results
    """
    @staticmethod
    def get_first(itr, constraint):
        """
        return the obj in the itr if constraint is true
        """
        return next((obj for obj in itr if constraint(obj)), None)

    @staticmethod
    def get_first_of_type(itr, typ):
        """