Beispiel #1
0
def test_transfer_object_end_to_end():
    error = analysis.TransferErrorEvent(LINE_ERROR)
    t = analysis.Transfer(error.transfer_id)
    t.add_event(error)
    assert_equals(
        t.get_data(), {
            'is_error': True,
            'endpoint_local': 'localhost:127.0.0.1:46878',
            'total_bytes_read': 0,
            'error_code': 'PROXY',
            'unix_ts_end': 1555940480.647663,
            'hostname_local': 'cyan',
            'endpoint_remote':
            'dc34og3c3aqdqntblnxkstzfvh7iy7llojd4fi5j23y2po32ock2k7ad.onion:0.0.0.0:8080',
            'elapsed_seconds': {
                'proxy_init': 0.000283,
                'proxy_request': 0.000412,
                'proxy_choice': 0.000348,
                'socket_connect': 0.00021,
                'socket_create': 1.1e-05
            },
            'method': 'GET',
            'is_commander': True,
            'total_bytes_write': 0,
            'unix_ts_start': 1555940480.6472511,
            'hostname_remote': '(null)',
            'transfer_id': 'transfer5m:4',
            'is_success': False,
            'payload_bytes_status': 0,
            'endpoint_proxy': 'localhost:127.0.0.1:43735',
            'is_complete': True,
            'filesize_bytes': 5242880
        })
Beispiel #2
0
def test_transfer_object_init():
    error = analysis.TransferErrorEvent(LINE_ERROR)
    t = analysis.Transfer(error.transfer_id)
    assert_equals(t.id, 'transfer5m:4')
    assert_equals(t.last_event, None)
    assert_equals(
        t.payload_progress, {
            0.0: None,
            0.1: None,
            0.2: None,
            0.3: None,
            0.4: None,
            0.5: None,
            0.6: None,
            0.7: None,
            0.8: None,
            0.9: None,
            1.0: None
        })
Beispiel #3
0
def test_transfer_object_add_event():
    error = analysis.TransferErrorEvent(LINE_ERROR)
    t = analysis.Transfer(error.transfer_id)
    t.add_event(error)
    assert_equals(t.last_event, error)
    assert_equals(
        t.payload_progress, {
            0.0: 1555940480.647663,
            0.1: None,
            0.2: None,
            0.3: None,
            0.4: None,
            0.5: None,
            0.6: None,
            0.7: None,
            0.8: None,
            0.9: None,
            1.0: None
        })
Beispiel #4
0
def test_transfer_error_event():
    error = analysis.TransferErrorEvent(LINE_ERROR)
    assert_equals(error.is_error, True)
    assert_equals(error.is_success, False)
Beispiel #5
0
def test_transfer_object_get_data_error():
    error = analysis.TransferErrorEvent(LINE_ERROR)
    t = analysis.Transfer(error.transfer_id)
    t.add_event(error)
    t.get_data()['elapsed_seconds']['payload_progress']