[{"data":1,"prerenderedAt":1891},["ShallowReactive",2],{"navigation":3,"\u002Ftesting":43,"\u002Ftesting-surround":1886},[4,8,13,18,23,28,33,38],{"title":5,"path":6,"stem":7},"Getting started","\u002F","index",{"title":9,"path":10,"stem":11,"order":12},"Numbers","\u002Fnumbers","numbers",1,{"title":14,"path":15,"stem":16,"order":17},"Rent","\u002Frent","rent",2,{"title":19,"path":20,"stem":21,"order":22},"User","\u002Fuser","user",3,{"title":24,"path":25,"stem":26,"order":27},"Free numbers","\u002Ffree","free",4,{"title":29,"path":30,"stem":31,"order":32},"Webhooks","\u002Fwebhooks","webhooks",5,{"title":34,"path":35,"stem":36,"order":37},"Testing","\u002Ftesting","testing",6,{"title":39,"path":40,"stem":41,"order":42},"Changelog","\u002Fchangelog","changelog",7,{"id":44,"title":34,"body":45,"description":1880,"extension":1881,"meta":1882,"navigation":1883,"path":35,"seo":1884,"stem":36,"__hash__":1885},"docs\u002Ftesting.md",{"type":46,"value":47,"toc":1872},"minimark",[48,70,75,160,329,452,477,546,550,568,882,907,911,939,1193,1254,1258,1274,1504,1508,1681,1685,1868],[49,50,51,55,56,61,62,65,66,69],"p",{},[52,53,54],"code",{},"MockOnlineSim"," is an in-process fake of the OnlineSim API that ships with the package. It is a ",[57,58,60],"a",{"href":59},"\u002F#transport","transport"," that answers like the real backend — same shapes, same error codes, HTTP 456 for a wrong key and HTTP 200 ",[52,63,64],{},"ERROR_WRONG_KEY"," for a missing one — and keeps a balance, operations and rents. Your code talks to a normal ",[52,67,68],{},"OnlineSim"," client, so nothing in it changes for tests. It is deterministic: no randomness, no clock, numbers and ids come from a counter.",[71,72,74],"h2",{"id":73},"setup","Setup",[76,77,82],"pre",{"className":78,"code":79,"language":80,"meta":81,"style":81},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","from onlinesimru import MockOnlineSim\n\nmock = MockOnlineSim(balance=10)\nclient = mock.client()  # an OnlineSim wired to the mock\n","python","",[52,83,84,102,108,137],{"__ignoreMap":81},[85,86,88,92,96,99],"span",{"class":87,"line":12},"line",[85,89,91],{"class":90},"s7zQu","from",[85,93,95],{"class":94},"sTEyZ"," onlinesimru ",[85,97,98],{"class":90},"import",[85,100,101],{"class":94}," MockOnlineSim\n",[85,103,104],{"class":87,"line":17},[85,105,107],{"emptyLinePlaceholder":106},true,"\n",[85,109,110,113,117,121,124,128,130,134],{"class":87,"line":22},[85,111,112],{"class":94},"mock ",[85,114,116],{"class":115},"sMK4o","=",[85,118,120],{"class":119},"s2Zo4"," MockOnlineSim",[85,122,123],{"class":115},"(",[85,125,127],{"class":126},"sHdIc","balance",[85,129,116],{"class":115},[85,131,133],{"class":132},"sbssI","10",[85,135,136],{"class":115},")\n",[85,138,139,142,144,147,150,153,156],{"class":87,"line":27},[85,140,141],{"class":94},"client ",[85,143,116],{"class":115},[85,145,146],{"class":94}," mock",[85,148,149],{"class":115},".",[85,151,152],{"class":119},"client",[85,154,155],{"class":115},"()",[85,157,159],{"class":158},"sHwdD","  # an OnlineSim wired to the mock\n",[76,161,163],{"className":78,"code":162,"language":80,"meta":81,"style":81},"MockOnlineSim(\n    *,\n    api_key: str = \"mock-key\",\n    balance: float = 100,                                  # USD\n    prices: Mapping[int, Mapping[str, float]] | None = None,  # country -> service -> USD\n    rent_tariffs: Mapping[int, MockRentTariff] | None = None,  # country -> {\"days\": {days: USD}, \"extend\": 0 | 1}\n    guard_interval: int = 0,                               # seconds\n)\n",[52,164,165,172,177,204,225,272,304,324],{"__ignoreMap":81},[85,166,167,169],{"class":87,"line":12},[85,168,54],{"class":119},[85,170,171],{"class":115},"(\n",[85,173,174],{"class":87,"line":17},[85,175,176],{"class":115},"    *,\n",[85,178,179,182,185,188,191,194,198,201],{"class":87,"line":22},[85,180,181],{"class":119},"    api_key",[85,183,184],{"class":115},":",[85,186,187],{"class":126}," str",[85,189,190],{"class":115}," =",[85,192,193],{"class":115}," \"",[85,195,197],{"class":196},"sfazB","mock-key",[85,199,200],{"class":115},"\"",[85,202,203],{"class":115},",\n",[85,205,206,209,211,214,216,219,222],{"class":87,"line":27},[85,207,208],{"class":119},"    balance",[85,210,184],{"class":115},[85,212,213],{"class":126}," float",[85,215,190],{"class":115},[85,217,218],{"class":132}," 100",[85,220,221],{"class":115},",",[85,223,224],{"class":158},"                                  # USD\n",[85,226,227,230,232,235,238,242,244,246,248,251,253,255,258,261,264,266,269],{"class":87,"line":32},[85,228,229],{"class":119},"    prices",[85,231,184],{"class":115},[85,233,234],{"class":119}," Mapping",[85,236,237],{"class":115},"[",[85,239,241],{"class":240},"sBMFI","int",[85,243,221],{"class":115},[85,245,234],{"class":119},[85,247,237],{"class":115},[85,249,250],{"class":240},"str",[85,252,221],{"class":115},[85,254,213],{"class":240},[85,256,257],{"class":115},"]]",[85,259,260],{"class":115}," |",[85,262,263],{"class":126}," None",[85,265,190],{"class":115},[85,267,268],{"class":115}," None,",[85,270,271],{"class":158},"  # country -> service -> USD\n",[85,273,274,277,279,281,283,285,287,290,293,295,297,299,301],{"class":87,"line":37},[85,275,276],{"class":119},"    rent_tariffs",[85,278,184],{"class":115},[85,280,234],{"class":119},[85,282,237],{"class":115},[85,284,241],{"class":240},[85,286,221],{"class":115},[85,288,289],{"class":119}," MockRentTariff",[85,291,292],{"class":115},"]",[85,294,260],{"class":115},[85,296,263],{"class":126},[85,298,190],{"class":115},[85,300,268],{"class":115},[85,302,303],{"class":158},"  # country -> {\"days\": {days: USD}, \"extend\": 0 | 1}\n",[85,305,306,309,311,314,316,319,321],{"class":87,"line":42},[85,307,308],{"class":119},"    guard_interval",[85,310,184],{"class":115},[85,312,313],{"class":126}," int",[85,315,190],{"class":115},[85,317,318],{"class":132}," 0",[85,320,221],{"class":115},[85,322,323],{"class":158},"                               # seconds\n",[85,325,327],{"class":87,"line":326},8,[85,328,136],{"class":115},[330,331,332,348],"table",{},[333,334,335],"thead",{},[336,337,338,342,345],"tr",{},[339,340,341],"th",{},"Option",[339,343,344],{},"Default",[339,346,347],{},"Description",[349,350,351,379,393,411,430],"tbody",{},[336,352,353,359,364],{},[354,355,356],"td",{},[52,357,358],{},"api_key",[354,360,361],{},[52,362,363],{},"\"mock-key\"",[354,365,366,367,370,371,374,375,378],{},"Key the mock accepts. ",[52,368,369],{},"mock.client()"," uses it; ",[52,372,373],{},"mock.client(api_key=\"x\")"," tests a wrong key (",[52,376,377],{},"\"\""," for none).",[336,380,381,385,390],{},[354,382,383],{},[52,384,127],{},[354,386,387],{},[52,388,389],{},"100",[354,391,392],{},"Starting balance, USD.",[336,394,395,400,405],{},[354,396,397],{},[52,398,399],{},"prices",[354,401,402],{},[52,403,404],{},"{7: {\"vkcom\": 0.5, \"telegram\": 1.2, \"google\": 0.3}, 44: {\"google\": 0.2, \"vkcom\": 0.36}}",[354,406,407,408,149],{},"Number prices; replaces the defaults. Also feeds ",[52,409,410],{},"numbers.tariffs()",[336,412,413,418,423],{},[354,414,415],{},[52,416,417],{},"rent_tariffs",[354,419,420],{},[52,421,422],{},"{7: {\"days\": {1: 1.0, 3: 2.5, 7: 5.0}, \"extend\": 1}}",[354,424,425,426,429],{},"Rent prices; ",[52,427,428],{},"\"extend\": 0"," makes rents of that country non-extendable.",[336,431,432,437,442],{},[354,433,434],{},[52,435,436],{},"guard_interval",[354,438,439],{},[52,440,441],{},"0",[354,443,444,447,448,451],{},[52,445,446],{},"> 0",": an operation without SMS, or an unconfirmed rent without any SMS, cannot be closed (",[52,449,450],{},"NO_COMPLETE_TZID",").",[49,453,454,457,458,462,463,465,466,469,470,472,473,476],{},[52,455,456],{},"mock.client(*, api_key, base_url, lang, dev_id, timeout)"," takes the usual ",[57,459,461],{"href":460},"\u002F#client-options","client options"," except ",[52,464,60],{},". To build the client yourself, pass ",[52,467,468],{},"mock.transport"," as ",[52,471,60],{},"; any ",[52,474,475],{},"base_url"," works:",[76,478,480],{"className":78,"code":479,"language":80,"meta":81,"style":81},"from onlinesimru import MockOnlineSim, OnlineSim\n\nmock = MockOnlineSim()\nclient = OnlineSim(\"mock-key\", transport=mock.transport)\n",[52,481,482,497,501,512],{"__ignoreMap":81},[85,483,484,486,488,490,492,494],{"class":87,"line":12},[85,485,91],{"class":90},[85,487,95],{"class":94},[85,489,98],{"class":90},[85,491,120],{"class":94},[85,493,221],{"class":115},[85,495,496],{"class":94}," OnlineSim\n",[85,498,499],{"class":87,"line":17},[85,500,107],{"emptyLinePlaceholder":106},[85,502,503,505,507,509],{"class":87,"line":22},[85,504,112],{"class":94},[85,506,116],{"class":115},[85,508,120],{"class":119},[85,510,511],{"class":115},"()\n",[85,513,514,516,518,521,523,525,527,529,531,534,536,539,541,544],{"class":87,"line":27},[85,515,141],{"class":94},[85,517,116],{"class":115},[85,519,520],{"class":119}," OnlineSim",[85,522,123],{"class":115},[85,524,200],{"class":115},[85,526,197],{"class":196},[85,528,200],{"class":115},[85,530,221],{"class":115},[85,532,533],{"class":126}," transport",[85,535,116],{"class":115},[85,537,538],{"class":119},"mock",[85,540,149],{"class":115},[85,542,60],{"class":543},"swJcz",[85,545,136],{"class":115},[71,547,549],{"id":548},"a-full-example","A full example",[49,551,552,553,556,557,560,561,563,564,567],{},"Order a number, let an SMS arrive while ",[52,554,555],{},"wait_code"," polls, check the code and the money. ",[52,558,559],{},"add_sms_after"," delivers the SMS after a number of polls instead of after some time, so ",[52,562,555],{}," runs with ",[52,565,566],{},"interval=0"," and the test takes milliseconds.",[76,569,571],{"className":78,"code":570,"language":80,"meta":81,"style":81},"from onlinesimru import MockOnlineSim\n\n\ndef test_receives_the_code() -> None:\n    mock = MockOnlineSim(balance=10)\n    client = mock.client()\n\n    order = client.numbers.get_with_number(\"google\", 44)\n    assert order[\"number\"] == \"+44900000001\"\n\n    mock.add_sms_after(order[\"tzid\"], \"Your Google code: 123-456\", 2)  # the third poll sees it\n    code = client.numbers.wait_code(order[\"tzid\"], interval=0)\n\n    assert code == \"123456\"\n    assert mock.operations()[0].status == \"TZ_OVER_OK\"  # wait_code closed it\n    assert mock.balance() == 9.8  # the price is spent once an SMS arrived\n",[52,572,573,583,587,591,608,627,642,646,681,712,717,762,803,808,826,861],{"__ignoreMap":81},[85,574,575,577,579,581],{"class":87,"line":12},[85,576,91],{"class":90},[85,578,95],{"class":94},[85,580,98],{"class":90},[85,582,101],{"class":94},[85,584,585],{"class":87,"line":17},[85,586,107],{"emptyLinePlaceholder":106},[85,588,589],{"class":87,"line":22},[85,590,107],{"emptyLinePlaceholder":106},[85,592,593,597,600,602,605],{"class":87,"line":27},[85,594,596],{"class":595},"spNyl","def",[85,598,599],{"class":119}," test_receives_the_code",[85,601,155],{"class":115},[85,603,604],{"class":115}," ->",[85,606,607],{"class":115}," None:\n",[85,609,610,613,615,617,619,621,623,625],{"class":87,"line":32},[85,611,612],{"class":94},"    mock ",[85,614,116],{"class":115},[85,616,120],{"class":119},[85,618,123],{"class":115},[85,620,127],{"class":126},[85,622,116],{"class":115},[85,624,133],{"class":132},[85,626,136],{"class":115},[85,628,629,632,634,636,638,640],{"class":87,"line":37},[85,630,631],{"class":94},"    client ",[85,633,116],{"class":115},[85,635,146],{"class":94},[85,637,149],{"class":115},[85,639,152],{"class":119},[85,641,511],{"class":115},[85,643,644],{"class":87,"line":42},[85,645,107],{"emptyLinePlaceholder":106},[85,647,648,651,653,656,658,660,662,665,667,669,672,674,676,679],{"class":87,"line":326},[85,649,650],{"class":94},"    order ",[85,652,116],{"class":115},[85,654,655],{"class":94}," client",[85,657,149],{"class":115},[85,659,11],{"class":543},[85,661,149],{"class":115},[85,663,664],{"class":119},"get_with_number",[85,666,123],{"class":115},[85,668,200],{"class":115},[85,670,671],{"class":196},"google",[85,673,200],{"class":115},[85,675,221],{"class":115},[85,677,678],{"class":132}," 44",[85,680,136],{"class":115},[85,682,684,687,690,692,694,697,699,701,704,706,709],{"class":87,"line":683},9,[85,685,686],{"class":90},"    assert",[85,688,689],{"class":94}," order",[85,691,237],{"class":115},[85,693,200],{"class":115},[85,695,696],{"class":196},"number",[85,698,200],{"class":115},[85,700,292],{"class":115},[85,702,703],{"class":115}," ==",[85,705,193],{"class":115},[85,707,708],{"class":196},"+44900000001",[85,710,711],{"class":115},"\"\n",[85,713,715],{"class":87,"line":714},10,[85,716,107],{"emptyLinePlaceholder":106},[85,718,720,723,725,727,729,732,734,736,739,741,744,746,749,751,753,756,759],{"class":87,"line":719},11,[85,721,722],{"class":94},"    mock",[85,724,149],{"class":115},[85,726,559],{"class":119},[85,728,123],{"class":115},[85,730,731],{"class":119},"order",[85,733,237],{"class":115},[85,735,200],{"class":115},[85,737,738],{"class":196},"tzid",[85,740,200],{"class":115},[85,742,743],{"class":115},"],",[85,745,193],{"class":115},[85,747,748],{"class":196},"Your Google code: 123-456",[85,750,200],{"class":115},[85,752,221],{"class":115},[85,754,755],{"class":132}," 2",[85,757,758],{"class":115},")",[85,760,761],{"class":158},"  # the third poll sees it\n",[85,763,765,768,770,772,774,776,778,780,782,784,786,788,790,792,794,797,799,801],{"class":87,"line":764},12,[85,766,767],{"class":94},"    code ",[85,769,116],{"class":115},[85,771,655],{"class":94},[85,773,149],{"class":115},[85,775,11],{"class":543},[85,777,149],{"class":115},[85,779,555],{"class":119},[85,781,123],{"class":115},[85,783,731],{"class":119},[85,785,237],{"class":115},[85,787,200],{"class":115},[85,789,738],{"class":196},[85,791,200],{"class":115},[85,793,743],{"class":115},[85,795,796],{"class":126}," interval",[85,798,116],{"class":115},[85,800,441],{"class":132},[85,802,136],{"class":115},[85,804,806],{"class":87,"line":805},13,[85,807,107],{"emptyLinePlaceholder":106},[85,809,811,813,816,819,821,824],{"class":87,"line":810},14,[85,812,686],{"class":90},[85,814,815],{"class":94}," code ",[85,817,818],{"class":115},"==",[85,820,193],{"class":115},[85,822,823],{"class":196},"123456",[85,825,711],{"class":115},[85,827,829,831,833,835,838,841,843,846,849,851,853,856,858],{"class":87,"line":828},15,[85,830,686],{"class":90},[85,832,146],{"class":94},[85,834,149],{"class":115},[85,836,837],{"class":119},"operations",[85,839,840],{"class":115},"()[",[85,842,441],{"class":132},[85,844,845],{"class":115},"].",[85,847,848],{"class":543},"status",[85,850,703],{"class":115},[85,852,193],{"class":115},[85,854,855],{"class":196},"TZ_OVER_OK",[85,857,200],{"class":115},[85,859,860],{"class":158},"  # wait_code closed it\n",[85,862,864,866,868,870,872,874,876,879],{"class":87,"line":863},16,[85,865,686],{"class":90},[85,867,146],{"class":94},[85,869,149],{"class":115},[85,871,127],{"class":119},[85,873,155],{"class":115},[85,875,703],{"class":115},[85,877,878],{"class":132}," 9.8",[85,880,881],{"class":158},"  # the price is spent once an SMS arrived\n",[49,883,884,885,888,889,892,893,895,896,899,900,903,904,906],{},"The ",[52,886,887],{},"msg"," of an operation is the code by default: the first run of 4–8 digits, with spaces and dashes between digits removed (",[52,890,891],{},"123-456"," → ",[52,894,823],{},"); a text without such a run comes back whole. ",[52,897,898],{},"message_to_code=False"," (or ",[52,901,902],{},"full_message=True"," in ",[52,905,555],{},") gives the full text.",[71,908,910],{"id":909},"errors","Errors",[49,912,913,916,917,920,921,899,924,927,928,931,932,935,936,451],{},[52,914,915],{},"fail_next(code)"," makes the next request answer ",[52,918,919],{},"{\"response\": code}"," — the client turns it into ",[52,922,923],{},"ApiError",[52,925,926],{},"NoNumberError",") exactly as for the real server. Pass ",[52,929,930],{},"endpoint"," to fail only that endpoint. ",[52,933,934],{},"fail_next_transport()"," makes the next request fail with a non-JSON HTTP 502 (",[52,937,938],{},"TransportError",[76,940,942],{"className":78,"code":941,"language":80,"meta":81,"style":81},"import pytest\n\nfrom onlinesimru import MockOnlineSim, NoNumberError, TransportError\n\n\ndef test_handles_a_missing_number_and_a_network_hiccup() -> None:\n    mock = MockOnlineSim()\n    client = mock.client()\n\n    mock.fail_next(\"NO_NUMBER\", endpoint=\"getNum.php\")\n    with pytest.raises(NoNumberError):\n        client.numbers.get(\"google\")\n\n    mock.fail_next_transport(status=503)\n    with pytest.raises(TransportError):\n        client.user.balance()\n\n    assert client.user.balance()[\"balance\"] == 100  # one-shot\n",[52,943,944,951,955,975,979,983,996,1006,1020,1024,1058,1078,1102,1106,1126,1142,1156,1161],{"__ignoreMap":81},[85,945,946,948],{"class":87,"line":12},[85,947,98],{"class":90},[85,949,950],{"class":94}," pytest\n",[85,952,953],{"class":87,"line":17},[85,954,107],{"emptyLinePlaceholder":106},[85,956,957,959,961,963,965,967,970,972],{"class":87,"line":22},[85,958,91],{"class":90},[85,960,95],{"class":94},[85,962,98],{"class":90},[85,964,120],{"class":94},[85,966,221],{"class":115},[85,968,969],{"class":94}," NoNumberError",[85,971,221],{"class":115},[85,973,974],{"class":94}," TransportError\n",[85,976,977],{"class":87,"line":27},[85,978,107],{"emptyLinePlaceholder":106},[85,980,981],{"class":87,"line":32},[85,982,107],{"emptyLinePlaceholder":106},[85,984,985,987,990,992,994],{"class":87,"line":37},[85,986,596],{"class":595},[85,988,989],{"class":119}," test_handles_a_missing_number_and_a_network_hiccup",[85,991,155],{"class":115},[85,993,604],{"class":115},[85,995,607],{"class":115},[85,997,998,1000,1002,1004],{"class":87,"line":42},[85,999,612],{"class":94},[85,1001,116],{"class":115},[85,1003,120],{"class":119},[85,1005,511],{"class":115},[85,1007,1008,1010,1012,1014,1016,1018],{"class":87,"line":326},[85,1009,631],{"class":94},[85,1011,116],{"class":115},[85,1013,146],{"class":94},[85,1015,149],{"class":115},[85,1017,152],{"class":119},[85,1019,511],{"class":115},[85,1021,1022],{"class":87,"line":683},[85,1023,107],{"emptyLinePlaceholder":106},[85,1025,1026,1028,1030,1033,1035,1037,1040,1042,1044,1047,1049,1051,1054,1056],{"class":87,"line":714},[85,1027,722],{"class":94},[85,1029,149],{"class":115},[85,1031,1032],{"class":119},"fail_next",[85,1034,123],{"class":115},[85,1036,200],{"class":115},[85,1038,1039],{"class":196},"NO_NUMBER",[85,1041,200],{"class":115},[85,1043,221],{"class":115},[85,1045,1046],{"class":126}," endpoint",[85,1048,116],{"class":115},[85,1050,200],{"class":115},[85,1052,1053],{"class":196},"getNum.php",[85,1055,200],{"class":115},[85,1057,136],{"class":115},[85,1059,1060,1063,1066,1068,1071,1073,1075],{"class":87,"line":719},[85,1061,1062],{"class":90},"    with",[85,1064,1065],{"class":94}," pytest",[85,1067,149],{"class":115},[85,1069,1070],{"class":119},"raises",[85,1072,123],{"class":115},[85,1074,926],{"class":119},[85,1076,1077],{"class":115},"):\n",[85,1079,1080,1083,1085,1087,1089,1092,1094,1096,1098,1100],{"class":87,"line":764},[85,1081,1082],{"class":94},"        client",[85,1084,149],{"class":115},[85,1086,11],{"class":543},[85,1088,149],{"class":115},[85,1090,1091],{"class":119},"get",[85,1093,123],{"class":115},[85,1095,200],{"class":115},[85,1097,671],{"class":196},[85,1099,200],{"class":115},[85,1101,136],{"class":115},[85,1103,1104],{"class":87,"line":805},[85,1105,107],{"emptyLinePlaceholder":106},[85,1107,1108,1110,1112,1115,1117,1119,1121,1124],{"class":87,"line":810},[85,1109,722],{"class":94},[85,1111,149],{"class":115},[85,1113,1114],{"class":119},"fail_next_transport",[85,1116,123],{"class":115},[85,1118,848],{"class":126},[85,1120,116],{"class":115},[85,1122,1123],{"class":132},"503",[85,1125,136],{"class":115},[85,1127,1128,1130,1132,1134,1136,1138,1140],{"class":87,"line":828},[85,1129,1062],{"class":90},[85,1131,1065],{"class":94},[85,1133,149],{"class":115},[85,1135,1070],{"class":119},[85,1137,123],{"class":115},[85,1139,938],{"class":119},[85,1141,1077],{"class":115},[85,1143,1144,1146,1148,1150,1152,1154],{"class":87,"line":863},[85,1145,1082],{"class":94},[85,1147,149],{"class":115},[85,1149,21],{"class":543},[85,1151,149],{"class":115},[85,1153,127],{"class":119},[85,1155,511],{"class":115},[85,1157,1159],{"class":87,"line":1158},17,[85,1160,107],{"emptyLinePlaceholder":106},[85,1162,1164,1166,1168,1170,1172,1174,1176,1178,1180,1182,1184,1186,1188,1190],{"class":87,"line":1163},18,[85,1165,686],{"class":90},[85,1167,655],{"class":94},[85,1169,149],{"class":115},[85,1171,21],{"class":543},[85,1173,149],{"class":115},[85,1175,127],{"class":119},[85,1177,840],{"class":115},[85,1179,200],{"class":115},[85,1181,127],{"class":196},[85,1183,200],{"class":115},[85,1185,292],{"class":115},[85,1187,703],{"class":115},[85,1189,218],{"class":132},[85,1191,1192],{"class":158},"  # one-shot\n",[49,1194,1195,1196,1199,1200,1202,1203,1206,1207,1210,1211,1214,1215,1218,1219,1222,1223,1226,1227,1229,1230,1210,1232,1235,1236,1239,1240,1243,1244,1247,1248,1243,1251,1253],{},"The state itself produces the real error codes too: ",[52,1197,1198],{},"WARNING_LOW_BALANCE"," when the balance is short, ",[52,1201,1039],{}," when ",[52,1204,1205],{},"reject"," matches the next number, ",[52,1208,1209],{},"UNDEFINED_COUNTRY"," \u002F ",[52,1212,1213],{},"ERROR_NO_SERVICE"," for unknown prices, ",[52,1216,1217],{},"ERROR_WRONG_TZID"," for an unknown or closed operation (",[52,1220,1221],{},"next"," too; ",[52,1224,1225],{},"ERROR_NO_TZID"," for tzid ",[52,1228,441],{},"), ",[52,1231,1209],{},[52,1233,1234],{},"UNDEFINED_DAYS"," for an unknown rent country or period, ",[52,1237,1238],{},"TRY_AGAIN_LATER"," for every refused ",[52,1241,1242],{},"rent.extend",", ",[52,1245,1246],{},"ERROR_NO_OPERATIONS"," for an unknown rent in ",[52,1249,1250],{},"rent.close",[52,1252,64],{}," for a wrong key (HTTP 456) or no key (HTTP 200).",[71,1255,1257],{"id":1256},"inspecting-requests","Inspecting requests",[49,1259,1260,1263,1264,1243,1267,1270,1271,149],{},[52,1261,1262],{},"mock.requests"," lists every request received as ",[52,1265,1266],{},"MockRequest(method, path, query, body)",[52,1268,1269],{},"path"," relative to ",[52,1272,1273],{},"\u002Fapi\u002F",[76,1275,1277],{"className":78,"code":1276,"language":80,"meta":81,"style":81},"from onlinesimru import MockOnlineSim, MockRequest\n\n\ndef test_sends_reject_as_a_comma_list() -> None:\n    mock = MockOnlineSim()\n    mock.client().numbers.get(\"google\", 44, reject=[\"4470\", \"4471\"])\n\n    assert mock.requests == [\n        MockRequest(\"GET\", \"getNum.php\", {\"service\": \"google\", \"country\": \"44\", \"reject\": \"4470,4471\", \"lang\": \"en\"}),\n    ]\n",[52,1278,1279,1294,1298,1302,1315,1325,1381,1385,1401,1499],{"__ignoreMap":81},[85,1280,1281,1283,1285,1287,1289,1291],{"class":87,"line":12},[85,1282,91],{"class":90},[85,1284,95],{"class":94},[85,1286,98],{"class":90},[85,1288,120],{"class":94},[85,1290,221],{"class":115},[85,1292,1293],{"class":94}," MockRequest\n",[85,1295,1296],{"class":87,"line":17},[85,1297,107],{"emptyLinePlaceholder":106},[85,1299,1300],{"class":87,"line":22},[85,1301,107],{"emptyLinePlaceholder":106},[85,1303,1304,1306,1309,1311,1313],{"class":87,"line":27},[85,1305,596],{"class":595},[85,1307,1308],{"class":119}," test_sends_reject_as_a_comma_list",[85,1310,155],{"class":115},[85,1312,604],{"class":115},[85,1314,607],{"class":115},[85,1316,1317,1319,1321,1323],{"class":87,"line":32},[85,1318,612],{"class":94},[85,1320,116],{"class":115},[85,1322,120],{"class":119},[85,1324,511],{"class":115},[85,1326,1327,1329,1331,1333,1336,1338,1340,1342,1344,1346,1348,1350,1352,1354,1356,1359,1362,1364,1367,1369,1371,1373,1376,1378],{"class":87,"line":37},[85,1328,722],{"class":94},[85,1330,149],{"class":115},[85,1332,152],{"class":119},[85,1334,1335],{"class":115},"().",[85,1337,11],{"class":543},[85,1339,149],{"class":115},[85,1341,1091],{"class":119},[85,1343,123],{"class":115},[85,1345,200],{"class":115},[85,1347,671],{"class":196},[85,1349,200],{"class":115},[85,1351,221],{"class":115},[85,1353,678],{"class":132},[85,1355,221],{"class":115},[85,1357,1358],{"class":126}," reject",[85,1360,1361],{"class":115},"=[",[85,1363,200],{"class":115},[85,1365,1366],{"class":196},"4470",[85,1368,200],{"class":115},[85,1370,221],{"class":115},[85,1372,193],{"class":115},[85,1374,1375],{"class":196},"4471",[85,1377,200],{"class":115},[85,1379,1380],{"class":115},"])\n",[85,1382,1383],{"class":87,"line":42},[85,1384,107],{"emptyLinePlaceholder":106},[85,1386,1387,1389,1391,1393,1396,1398],{"class":87,"line":326},[85,1388,686],{"class":90},[85,1390,146],{"class":94},[85,1392,149],{"class":115},[85,1394,1395],{"class":543},"requests",[85,1397,703],{"class":115},[85,1399,1400],{"class":115}," [\n",[85,1402,1403,1406,1408,1410,1413,1415,1417,1419,1421,1423,1425,1428,1430,1433,1435,1437,1439,1441,1443,1445,1447,1450,1452,1454,1456,1459,1461,1463,1465,1467,1469,1471,1473,1476,1478,1480,1482,1485,1487,1489,1491,1494,1496],{"class":87,"line":683},[85,1404,1405],{"class":119},"        MockRequest",[85,1407,123],{"class":115},[85,1409,200],{"class":115},[85,1411,1412],{"class":196},"GET",[85,1414,200],{"class":115},[85,1416,221],{"class":115},[85,1418,193],{"class":115},[85,1420,1053],{"class":196},[85,1422,200],{"class":115},[85,1424,221],{"class":115},[85,1426,1427],{"class":115}," {",[85,1429,200],{"class":115},[85,1431,1432],{"class":196},"service",[85,1434,200],{"class":115},[85,1436,184],{"class":115},[85,1438,193],{"class":115},[85,1440,671],{"class":196},[85,1442,200],{"class":115},[85,1444,221],{"class":115},[85,1446,193],{"class":115},[85,1448,1449],{"class":196},"country",[85,1451,200],{"class":115},[85,1453,184],{"class":115},[85,1455,193],{"class":115},[85,1457,1458],{"class":196},"44",[85,1460,200],{"class":115},[85,1462,221],{"class":115},[85,1464,193],{"class":115},[85,1466,1205],{"class":196},[85,1468,200],{"class":115},[85,1470,184],{"class":115},[85,1472,193],{"class":115},[85,1474,1475],{"class":196},"4470,4471",[85,1477,200],{"class":115},[85,1479,221],{"class":115},[85,1481,193],{"class":115},[85,1483,1484],{"class":196},"lang",[85,1486,200],{"class":115},[85,1488,184],{"class":115},[85,1490,193],{"class":115},[85,1492,1493],{"class":196},"en",[85,1495,200],{"class":115},[85,1497,1498],{"class":115},"}),\n",[85,1500,1501],{"class":87,"line":714},[85,1502,1503],{"class":115},"    ]\n",[71,1505,1507],{"id":1506},"control-api","Control API",[330,1509,1510,1519],{},[333,1511,1512],{},[336,1513,1514,1517],{},[339,1515,1516],{},"Member",[339,1518,347],{},[349,1520,1521,1534,1546,1563,1591,1610,1622,1639,1659,1671],{},[336,1522,1523,1528],{},[354,1524,1525],{},[52,1526,1527],{},"client(**options)",[354,1529,1530,1531,1533],{},"A normal ",[52,1532,68],{}," wired to the mock.",[336,1535,1536,1540],{},[354,1537,1538],{},[52,1539,60],{},[354,1541,1542,1543,451],{},"The fake transport (",[52,1544,1545],{},"Callable[[HttpRequest], HttpResponse]",[336,1547,1548,1553],{},[354,1549,1550],{},[52,1551,1552],{},"add_sms(tzid, text, *, service=None)",[354,1554,1555,1556,1558,1559,1562],{},"An SMS arrives now at a number operation or a rent (detected by ",[52,1557,738],{},"). Raises ",[52,1560,1561],{},"ValueError"," for an unknown or closed one.",[336,1564,1565,1570],{},[354,1566,1567],{},[52,1568,1569],{},"add_sms_after(tzid, text, polls, *, service=None)",[354,1571,1572,1573,1576,1577,1579,1580,6,1583,1243,1586,6,1589,451],{},"The SMS arrives after ",[52,1574,1575],{},"polls"," state requests for ",[52,1578,738],{}," (",[52,1581,1582],{},"numbers.state",[52,1584,1585],{},"state_one",[52,1587,1588],{},"rent.state",[52,1590,1585],{},[336,1592,1593,1598],{},[354,1594,1595],{},[52,1596,1597],{},"fail_next(code, *, endpoint=None)",[354,1599,1600,1601,1603,1604,1607,1608,149],{},"The next request (to ",[52,1602,930],{}," only, e.g. ",[52,1605,1606],{},"\"getNum.php\"",") answers ",[52,1609,919],{},[336,1611,1612,1617],{},[354,1613,1614],{},[52,1615,1616],{},"fail_next_transport(*, status=502, endpoint=None)",[354,1618,1619,1620,149],{},"The next request fails with a non-JSON body and HTTP ",[52,1621,848],{},[336,1623,1624,1632],{},[354,1625,1626,1210,1629],{},[52,1627,1628],{},"set_balance(usd)",[52,1630,1631],{},"balance()",[354,1633,1634,1635,1638],{},"Set \u002F read the total balance, USD (it includes the part frozen by open operations, as ",[52,1636,1637],{},"user.balance()"," reports it).",[336,1640,1641,1649],{},[354,1642,1643,1210,1646],{},[52,1644,1645],{},"operations()",[52,1647,1648],{},"rents()",[354,1650,1651,1652,1210,1655,1658],{},"Copies of the current number operations \u002F open rents (",[52,1653,1654],{},"MockOperation",[52,1656,1657],{},"MockRent"," dataclasses), for assertions.",[336,1660,1661,1665],{},[354,1662,1663],{},[52,1664,1395],{},[354,1666,1667,1668,451],{},"Log of the requests received (",[52,1669,1670],{},"list[MockRequest]",[336,1672,1673,1678],{},[354,1674,1675],{},[52,1676,1677],{},"reset()",[354,1679,1680],{},"Back to the constructor's state.",[71,1682,1684],{"id":1683},"what-the-mock-does","What the mock does",[1686,1687,1688,1724,1790,1842,1851],"ul",{},[1689,1690,1691,1694,1695,1697,1698,1701,1702,1704,1705,1708,1709,1712,1713,1716,1717,1719,1720,1723],"li",{},[1692,1693,9],"strong",{},": ",[52,1696,1091],{}," freezes the price; ",[52,1699,1700],{},"close"," after an SMS spends it, ",[52,1703,1700],{}," without one refunds it; ",[52,1706,1707],{},"ban"," after an SMS answers ",[52,1710,1711],{},"\"0\"",", like the server. Numbers are ",[52,1714,1715],{},"+\u003Ccountry>9000000NN",", ids count from 1. ",[52,1718,1221],{}," switches to the following SMS. The operation's ",[52,1721,1722],{},"time"," stays at 1200 s — there is no clock.",[1689,1725,1726,1694,1728,1730,1731,1733,1734,1243,1736,1733,1739,1742,1743,1746,1747,1750,1751,1733,1753,1756,1757,1760,1761,1733,1763,1765,1766,1769,1770,1772,1773,1776,1777,6,1779,1781,1782,1785,1786,1789],{},[1692,1727,14],{},[52,1729,1091],{}," reserves the price (",[52,1732,848],{}," ",[52,1735,441],{},[52,1737,1738],{},"checked",[52,1740,1741],{},"False",") and keeps the ",[52,1744,1745],{},"extension"," flag; the first SMS that is not ",[52,1748,1749],{},"notify"," confirms the rent (",[52,1752,848],{},[52,1754,1755],{},"1",") and charges it — ",[52,1758,1759],{},"add_sms(tzid, text, service=\"notify\")"," adds a notice with ",[52,1762,52],{},[52,1764,441],{}," that confirms nothing. ",[52,1767,1768],{},"extend"," works on a confirmed rent and charges at once. ",[52,1771,1700],{}," releases the reservation of an unconfirmed rent and gives no refund for a confirmed one. ",[52,1774,1775],{},"sum"," is a number in ",[52,1778,1091],{},[52,1780,1768],{}," and a decimal string on the wire of ",[52,1783,1784],{},"state",", like the server. SMS appear in ",[52,1787,1788],{},"messages",", newest first.",[1689,1791,1792,1694,1794,1796,1797,1800,1801,1804,1805,1808,1809,1812,1813,1817,1818,1821,1822,1733,1824,1826,1827,1829,1830,1833,1834,1837,1838,1841],{},[1692,1793,19],{},[52,1795,127],{}," (frozen part included), a fixed profile, ",[52,1798,1799],{},"set_webhook_url"," accepts any ",[52,1802,1803],{},"scheme:\u002F\u002F…"," URL (",[52,1806,1807],{},"VALIDATION_ERROR"," otherwise), ",[52,1810,1811],{},"webhook_logs"," lists the deliveries the mock ",[1814,1815,1816],"em",{},"recorded"," when an SMS arrived while a webhook URL was set — it makes no HTTP call; their ",[52,1819,1820],{},"params"," follow the real payload (",[52,1823,52],{},[52,1825,377],{}," without a code, rent ",[52,1828,696],{}," in digits without ",[52,1831,1832],{},"+",", rent ",[52,1835,1836],{},"time_left"," in minutes). ",[52,1839,1840],{},"payment_history"," has no orders.",[1689,1843,1844,1694,1847,1850],{},[1692,1845,1846],{},"Free",[52,1848,1849],{},"free.list"," returns two fixed countries (44 first) with one number and a few SMS each.",[1689,1852,1853,1854,1579,1857,1860,1861,1863,1864,1867],{},"Not imitated: anything that needs real time — the 5 s lock after ",[52,1855,1856],{},"setOperationOk",[52,1858,1859],{},"INTERVAL_CONCURRENT_REQUESTS_ERROR","), the 10 s lock of ",[52,1862,1242],{},", the 120 s before an unconfirmed rent may be closed and its 20-minute wait for the first SMS. ",[52,1865,1866],{},"guard_interval > 0"," stands in for \"too early to close\".",[1869,1870,1871],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}",{"title":81,"searchDepth":17,"depth":17,"links":1873},[1874,1875,1876,1877,1878,1879],{"id":73,"depth":17,"text":74},{"id":548,"depth":17,"text":549},{"id":909,"depth":17,"text":910},{"id":1256,"depth":17,"text":1257},{"id":1506,"depth":17,"text":1507},{"id":1683,"depth":17,"text":1684},"Test your integration offline with MockOnlineSim — no network, key or money.","md",{},{"order":37},{"title":34,"description":1880},"x6twqOlesek6tbCCd8eGVJv7DMwLnVfnfc5zBsiVqvY",[1887,1889],{"title":14,"path":15,"stem":16,"description":1888,"order":17},"Rent a number for days and receive every SMS sent to it — client.rent.",{"title":19,"path":20,"stem":21,"description":1890,"order":22},"Balance, profile, payments and the webhook URL — client.user.",1795164115455]