57 lines
2.6 KiB
Python
57 lines
2.6 KiB
Python
|
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|</a0iuk[zKl`TCPJ@Lg'),
|
||
|
(2345263976, 'PdRDKQOGUR9N%u[Z]V8)Bk&w4pZA&fL)'),
|
||
|
(4257500092, 'H<k}7'),
|
||
|
(3154389339, '8GO8Z[PYc*n7.q5h3Z'),
|
||
|
(2072333469, '*9XT,vR[T")MKn_?Ipjz7i\'sK4v-x$(7'),
|
||
|
(2744233032, 'xhA`:C;ayjRde=9waMz^?;A'),
|
||
|
(1487552026, '4.W\' * HXKyT2S'),
|
||
|
(1285622434, '(mf6\\,/^p+75]poQoE+-Z'),
|
||
|
(241589744, 'Wa[Z~ut@IV:WtuY[[vqP9\\]D7!wsr4)n~'),
|
||
|
(3697213109, 'ZOU)K:0u#'),
|
||
|
(1906064925, 'xstE~dJc\'89InXPfaQt}Y{'),
|
||
|
(3801716305, 'vqR`:@Cv%b3t'),
|
||
|
(3666699445, 'n{G[}]u-XzYE[?;p.+_4V.C1b-D&'),
|
||
|
(1647934306, ':l_BcBfmh:Cy\'Y\'4@1O'),
|
||
|
(2250612563, 'dXd)xD`RwCkHCu)1z-d\\PT)/X:bsFQ,f2'),
|
||
|
(103903630, 'mB9I_BO;rG):Ss3}-_+GHh=*#'),
|
||
|
(3766121887, 'J3_`pKPo'),
|
||
|
(93663118, 'N6:y[P/nlA@xGQ`<LLcv|a\'i"J>?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)
|