2
2
import os
3
3
4
4
5
+ def _sort_array_of_actions (x ):
6
+ paths = [y ["path" ] for y in x ]
7
+ paths .sort ()
8
+ order = {}
9
+ for i , p in enumerate (paths ):
10
+ order [p ] = i
11
+ output = [None ] * len (x )
12
+ for y in x :
13
+ output [order [y ["path" ]]] = y
14
+ return output
15
+
16
+
5
17
def test_reroute_links ():
6
18
_ , staging , registry , url = pyg .start_gobbler ()
7
19
@@ -17,7 +29,6 @@ def test_reroute_links():
17
29
pyg .upload_directory ("test-reroute" , "simple" , "v3" , src , staging = staging , url = url )
18
30
19
31
actions = pyg .reroute_links ([{"project" :"test-reroute" , "asset" :"simple" , "version" :"v1" }], staging = staging , url = url , dry_run = True )
20
- print (actions )
21
32
assert all ([x ["source" ] == "test-reroute/simple/v1/foo" for x in actions ])
22
33
all_paths = [x ["path" ] for x in actions ]
23
34
assert "test-reroute/simple/v2/foo" in all_paths
@@ -28,5 +39,5 @@ def test_reroute_links():
28
39
assert os .path .islink (os .path .join (registry , "test-reroute/simple/v2/foo" ))
29
40
30
41
actions2 = pyg .reroute_links ([{"project" :"test-reroute" , "asset" :"simple" , "version" :"v1" }], staging = staging , url = url )
31
- assert actions == actions2
42
+ assert _sort_array_of_actions ( actions ) == _sort_array_of_actions ( actions2 )
32
43
assert not os .path .islink (os .path .join (registry , "test-reroute/simple/v2/foo" ))
0 commit comments