from wgus import PatchesChains


def test_parse():
    data = """
    <protocol name="patches_chain" version="1.9" wgc_publisher_id="wargaming,steam">
    <patches_chain type="install">
    <patch>
    <files>
    <file>
    <name>wot_1.14.1.3252_ru_vtlj1d/wot_1.14.1.1663850_locale_ru.wgpkg</name>
    <size>25326691</size>
    <unpacked_size>31281758</unpacked_size>
    </file>
    </files>
    <torrent>
    <hash>245ffc7538bf793894491b17090d69e646b70825ba1de074679046da71283be8</hash>
    <urls>
    <url>https://dl-wot-gc.wargaming.net/ru/patches/wot_1.14.1.3252_ru_vtlj1d/wot_1.14.1.3252_ru.torrent</url>
    </urls>
    </torrent>
    <part>locale</part>
    <version_to>1.14.1.1663850</version_to>
    </patch>
    <patch>
    <files>
    <file>
    <name>wot_1.14.1.3186_ru_aa0jt9/wot_1.14.1.21618_client.wgpkg.001</name>
    <size>4194304000</size>
    <unpacked_size>12957669925</unpacked_size>
    </file>
    <file>
    <name>wot_1.14.1.3186_ru_aa0jt9/wot_1.14.1.21618_client.wgpkg.002</name>
    <size>4184272193</size>
    <unpacked_size>0</unpacked_size>
    </file>
    </files>
    <torrent>
    <hash>105b3d87dd8f08bc012800906ba1a467c5fef4ebaffa04902473677ef3d0c155</hash>
    <urls>
    <url>https://dl-wot-gc.wargaming.net/ru/patches/wot_1.14.1.3186_ru_aa0jt9/wot_1.14.1.3186_ru.torrent</url>
    </urls>
    </torrent>
    <part>client</part>
    <version_to>1.14.1.21618</version_to>
    </patch>
    <patch>
    <files>
    <file>
    <name>wot_1.14.1.3193_ru_la952m/wot_1.14.1.21624_1.14.1.21618_client.wgpkg</name>
    <size>55703224</size>
    <unpacked_size>131328708</unpacked_size>
    <diffs_size>7941114817</diffs_size>
    </file>
    </files>
    <torrent>
    <hash>1ccb7ac1facfbf22b60989bb4a0376c1d0f7ea9fe35a6b9d63ea4b7ca4de87aa</hash>
    <urls>
    <url>https://dl-wot-gc.wargaming.net/ru/patches/wot_1.14.1.3193_ru_la952m/wot_1.14.1.3193_ru.torrent</url>
    </urls>
    </torrent>
    <part>client</part>
    <version_to>1.14.1.21624</version_to>
    </patch>
    <patch>
    <files>
    <file>
    <name>wot_1.14.1.3239_ru_ib3c5x/wot_1.14.1.21637_1.14.1.21624_client.wgpkg</name>
    <size>15395960</size>
    <unpacked_size>20030646</unpacked_size>
    <diffs_size>3766081307</diffs_size>
    </file>
    </files>
    <torrent>
    <hash>cf0bf16818a1e902fc94af4107664334616dca234df1d8960b7ca69fb7fdee4b</hash>
    <urls>
    <url>https://dl-wot-gc.wargaming.net/ru/patches/wot_1.14.1.3239_ru_ib3c5x/wot_1.14.1.3239_ru.torrent</url>
    </urls>
    </torrent>
    <part>client</part>
    <version_to>1.14.1.21637</version_to>
    </patch>
    <patch>
    <files>
    <file>
    <name>wot_1.14.1.3247_ru_qd0mnp/wot_1.14.1.21661_1.14.1.21637_client.wgpkg</name>
    <size>594078157</size>
    <unpacked_size>796205967</unpacked_size>
    <diffs_size>9090130583</diffs_size>
    </file>
    </files>
    <torrent>
    <hash>eb758887e3497b911691fc69c25cf586927f0fe786cf32b66a55823c003a8702</hash>
    <urls>
    <url>https://dl-wot-gc.wargaming.net/ru/patches/wot_1.14.1.3247_ru_qd0mnp/wot_1.14.1.3247_ru.torrent</url>
    </urls>
    </torrent>
    <part>client</part>
    <version_to>1.14.1.21661</version_to>
    </patch>
    <patch>
    <files>
    <file>
    <name>wot_1.14.1.3266_ru_xb0636/wot_1.14.1.21675_1.14.1.21661_client.wgpkg</name>
    <size>48174</size>
    <unpacked_size>75218</unpacked_size>
    <diffs_size>125343471</diffs_size>
    </file>
    </files>
    <torrent>
    <hash>b353aa48e8b46ed7502b25dbb4fc51dcfa380f676c450e0cd579e4e4bb116e73</hash>
    <urls>
    <url>https://dl-wot-gc.wargaming.net/ru/patches/wot_1.14.1.3266_ru_xb0636/wot_1.14.1.3266_ru.torrent</url>
    </urls>
    </torrent>
    <part>client</part>
    <version_to>1.14.1.21675</version_to>
    </patch>
    <patch>
    <files>
    <file>
    <name>wot_1.14.1.3186_ru_aa0jt9/wot_1.14.1.21618_sdcontent.wgpkg.001</name>
    <size>4194304000</size>
    <unpacked_size>26552838287</unpacked_size>
    </file>
    <file>
    <name>wot_1.14.1.3186_ru_aa0jt9/wot_1.14.1.21618_sdcontent.wgpkg.002</name>
    <size>4194304000</size>
    <unpacked_size>0</unpacked_size>
    </file>
    <file>
    <name>wot_1.14.1.3186_ru_aa0jt9/wot_1.14.1.21618_sdcontent.wgpkg.003</name>
    <size>1943655010</size>
    <unpacked_size>0</unpacked_size>
    </file>
    </files>
    <torrent>
    <hash>105b3d87dd8f08bc012800906ba1a467c5fef4ebaffa04902473677ef3d0c155</hash>
    <urls>
    <url>https://dl-wot-gc.wargaming.net/ru/patches/wot_1.14.1.3186_ru_aa0jt9/wot_1.14.1.3186_ru.torrent</url>
    </urls>
    </torrent>
    <part>sdcontent</part>
    <version_to>1.14.1.21618</version_to>
    </patch>
    <patch>
    <files>
    <file>
    <name>wot_1.14.1.3193_ru_la952m/wot_1.14.1.21624_1.14.1.21618_sdcontent.wgpkg</name>
    <size>135449</size>
    <unpacked_size>188905</unpacked_size>
    <diffs_size>1366361750</diffs_size>
    </file>
    </files>
    <torrent>
    <hash>1ccb7ac1facfbf22b60989bb4a0376c1d0f7ea9fe35a6b9d63ea4b7ca4de87aa</hash>
    <urls>
    <url>https://dl-wot-gc.wargaming.net/ru/patches/wot_1.14.1.3193_ru_la952m/wot_1.14.1.3193_ru.torrent</url>
    </urls>
    </torrent>
    <part>sdcontent</part>
    <version_to>1.14.1.21624</version_to>
    </patch>
    <patch>
    <files>
    <file>
    <name>wot_1.14.1.3247_ru_qd0mnp/wot_1.14.1.21661_1.14.1.21624_sdcontent.wgpkg</name>
    <size>306984314</size>
    <unpacked_size>786453093</unpacked_size>
    <diffs_size>14466667087</diffs_size>
    </file>
    </files>
    <torrent>
    <hash>eb758887e3497b911691fc69c25cf586927f0fe786cf32b66a55823c003a8702</hash>
    <urls>
    <url>https://dl-wot-gc.wargaming.net/ru/patches/wot_1.14.1.3247_ru_qd0mnp/wot_1.14.1.3247_ru.torrent</url>
    </urls>
    </torrent>
    <part>sdcontent</part>
    <version_to>1.14.1.21661</version_to>
    </patch>
    <patch>
    <files>
    <file>
    <name>wot_1.14.1.3186_ru_aa0jt9/wot_1.14.1.21618_hdcontent.wgpkg.001</name>
    <size>4194304000</size>
    <unpacked_size>19862853844</unpacked_size>
    </file>
    <file>
    <name>wot_1.14.1.3186_ru_aa0jt9/wot_1.14.1.21618_hdcontent.wgpkg.002</name>
    <size>4194304000</size>
    <unpacked_size>0</unpacked_size>
    </file>
    <file>
    <name>wot_1.14.1.3186_ru_aa0jt9/wot_1.14.1.21618_hdcontent.wgpkg.003</name>
    <size>3005599718</size>
    <unpacked_size>0</unpacked_size>
    </file>
    </files>
    <torrent>
    <hash>105b3d87dd8f08bc012800906ba1a467c5fef4ebaffa04902473677ef3d0c155</hash>
    <urls>
    <url>https://dl-wot-gc.wargaming.net/ru/patches/wot_1.14.1.3186_ru_aa0jt9/wot_1.14.1.3186_ru.torrent</url>
    </urls>
    </torrent>
    <part>hdcontent</part>
    <version_to>1.14.1.21618</version_to>
    </patch>
    <patch>
    <files>
    <file>
    <name>wot_1.14.1.3247_ru_qd0mnp/wot_1.14.1.21661_1.14.1.21618_hdcontent.wgpkg</name>
    <size>369097545</size>
    <unpacked_size>656771030</unpacked_size>
    <diffs_size>13160407318</diffs_size>
    </file>
    </files>
    <torrent>
    <hash>eb758887e3497b911691fc69c25cf586927f0fe786cf32b66a55823c003a8702</hash>
    <urls>
    <url>https://dl-wot-gc.wargaming.net/ru/patches/wot_1.14.1.3247_ru_qd0mnp/wot_1.14.1.3247_ru.torrent</url>
    </urls>
    </torrent>
    <part>hdcontent</part>
    <version_to>1.14.1.21661</version_to>
    </patch>
    <web_seeds>
    <url threads="3" name="G-Core">http://dl-wot-gc.wargaming.net/ru/patches/</url>
    <url threads="1" name="Cedexis">http://dl-wot-cdx.wargaming.net/ru/patches/</url>
    </web_seeds>
    <meta_need_update>False</meta_need_update>
    <version_name>1.14.1.3252</version_name>
    </patches_chain>
    </protocol>"""
    chains = PatchesChains.parse(data)
    assert chains
