Example #1
0
def test_hashes(get_request_mock, handle_error_mock):
    from indexclient.client import IndexClient
    input_params = {
        'hashes': {
            'md5': '00000000000000000000000000000001'
        },
        'size': '1'
    }

    expected_format = {
        'hash': ['md5:00000000000000000000000000000001'],
        'size': '1',
        'limit': 1
    }

    with patch("indexclient.client.IndexClient._get") as get_mock:
        client = IndexClient('base_url')
        client.get_with_params(input_params)

        assert get_mock.called
        args, kwargs = get_mock.call_args_list[0]
        assert kwargs['params'] == expected_format
Example #2
0
def test_hashes(get_request_mock, handle_error_mock):
    from indexclient.client import IndexClient

    input_params = {
        "hashes": {
            "md5": "00000000000000000000000000000001"
        },
        "size": "1"
    }

    expected_format = {
        "hash": ["md5:00000000000000000000000000000001"],
        "size": "1",
        "limit": 1,
    }

    with patch("indexclient.client.IndexClient._get") as get_mock:
        client = IndexClient("base_url")
        client.get_with_params(input_params)

        assert get_mock.called
        args, kwargs = get_mock.call_args_list[0]
        assert kwargs["params"] == expected_format