import pytest from repo_cloner.lib.checksum import mem_crc, gen_repo_hashed_name @pytest.mark.parametrize('expected,input', [ (636040475, '114>N3YY\'sP'), (3683742091, 'W-=k|?a'), (609503553, 'Sa=LH{I0zxW@;=DB8}9@p#W&tN<0N'), (1992681077, ';7zXbN;|+-t{+OqNXLev~118>#}/4hlxnyxj'), (410705017, 'hwf:6s*ecO#'), (50594608, '2TgG@I'), (2643914704, ':Sil>z)"Q{8V83(Fx6kf'), (1603724503, 'P):`,(z>4d?c7@.IY%[yTZa'), (2699769372, 'I;jqRmobBJ7B'), (944082450, '~8"_te]:1x_dK$c}R&'), ]) def test_mem_crc(expected, input: str): assert expected == mem_crc(input.encode()) @pytest.mark.parametrize('path,url', [ ('zpravovnik_skype-fuckup-container_148175543.git', 'git@git.swamp.ga:zpravovnik/skype-fuckup-container.git'), ('ohl_ink-depman_338374875.git', 'git@git.swamp.ga:ohl/ink-depman.git'), ('ohl_ink-fakemodbus_3727882297.git', 'git@git.swamp.ga:ohl/ink-fakemodbus.git'), ('kamikaze_laminar-wrap_3224706074.git', 'git@git.swamp.ga:kamikaze/laminar-wrap.git'), ('graemeg_lazarus_3217969491.git', 'https://github.com/graemeg/lazarus.git'), ('tojemi_php-test-container_592814724.git', 'git@git.swamp.ga:tojemi/php-test-container.git'), ('kamikaze_repo-cloner_1874209794.git', 'git@git.sw3.cz:kamikaze/repo-cloner.git'), ('smalls_shakeeper_2796015744.git', 'git@git.swamp.ga:smalls/shakeeper.git'), ('ycnet_tetsssd_809780385.git', 'git@git.swamp.ga:ycnet/tetsssd.git'), ('kamikaze_repo-cloner_3447183070.git', 'https://git.sw3.cz/kamikaze/repo-cloner.git'), ('valicek_testvn_3613709968.git', 'git@git.swamp.ga:valicek/testvn.git'), ('valicek_thermocouple-tables_3520628733.git', 'git@git.swamp.ga:valicek/thermocouple-tables.git'), ('tojemi_tojemi.cz_34301162.git', 'git@git.swamp.ga:tojemi/tojemi.cz.git'), ('numid_updater-toolbox_2903171139.git', 'git@git.swamp.ga:numid/updater-toolbox.git'), ('dev_project_1164685478.git', '/home/git/dev/project/.git'), ]) def test_gen_repo_hashed_name(path, url): assert path == gen_repo_hashed_name(url)