Пример #1
0
def test_send_mul(requester):
    hlrls = [api.HLRL(msisdn=380960000000), api.HLRL(msisdn=380960000001)]
    response = requester.send(hlrls)
    assert response.get('result')
    assert len(response.get('result')) == 2
    for response_ in response['result']:
        for attribute in RESPOND_ATTRIBUTES:
            # need to check for None, else false-positive assertion on error==0
            assert response_.get(attribute) is not None
Пример #2
0
def test_hlrl():
    hlrl = api.HLRL(msisdn=380960000000)

    assert len(hlrl) == 2

    attributes = ['msisdn', 'reference']
    for attribute in attributes:
        assert hlrl.get(attribute)
Пример #3
0
def test_getstatus_for_internal_hlrls_partly(sender_mul_by_internal):
    sender_mul_by_internal.get_status()
    sender_mul_by_internal.hlrls[-5] = api.HLRL(msisdn=380960000000)
    sender_mul_by_internal.get_status()
    for hlrl in sender_mul_by_internal.hlrls:
        assert hlrl.get('status')
        for attribute in STATUS_ATTRIBUTES:
            assert hlrl['status'].get(attribute) is not None
Пример #4
0
def main():
    from examples.settings import API_KEY

    try:
        client = api.HLRAPI(config={'api_key': API_KEY})
        prices = client.get_prices()
        print('HLR Prices (first 5 elements from {}): \n{}'.format(len(prices), pprint.pformat(prices[0:5], indent=4)))
        lookup_list = api.HLRL(380970000000)
        print('Created HLR request: \n{}'.format(pprint.pformat(lookup_list, indent=4)))
        result = client.send(lookup_list)
        result_id = result['result'][0]['id']
        status_id = client.get_status(result_id)
        result_ref = result['result'][0]['reference']
        status_ref = client.get_status(result_ref)
        print('Current HLR response by id: \n{}'.format(pprint.pformat(status_id, indent=4)))
        print('Current HLR response by reference: \n{}'.format(pprint.pformat(status_ref, indent=4)))
    except api.APIError as exc:
        print('Error on HLR request processing: {}'.format(pprint.pformat(exc, indent=4)), file=sys.stderr)
        exit(1)
Пример #5
0
def sender_mul(requester):
    hlrls = [api.HLRL(msisdn=380960000000), api.HLRL(msisdn=380960000001)]
    return requester, requester.send(hlrls)
Пример #6
0
def test_getstatus_for_obj_without_result(requester):
    hlrl = api.HLRL(msisdn=380960000000)
    status = requester.get_status(hlrl)
    for attribute in STATUS_ATTRIBUTES:
        assert status.get(attribute) is not None