@@ -114,8 +114,11 @@ def test_autoupdate_out_of_date_repo(
114114 )
115115 write_config ('.' , config )
116116
117+ runner = Runner ('.' , C .CONFIG_FILE )
117118 before = open (C .CONFIG_FILE ).read ()
118- ret = autoupdate (Runner ('.' , C .CONFIG_FILE ), tags_only = False )
119+ repo_name = 'file://{}' .format (out_of_date_repo .path )
120+ # It will update the repo, because the name matches
121+ ret = autoupdate (runner , tags_only = False , repo = repo_name )
119122 after = open (C .CONFIG_FILE ).read ()
120123 assert ret == 0
121124 assert before != after
@@ -124,6 +127,24 @@ def test_autoupdate_out_of_date_repo(
124127 assert out_of_date_repo .head_sha in after
125128
126129
130+ def test_autoupdate_out_of_date_repo_wrong_repo_name (
131+ out_of_date_repo , in_tmpdir , mock_out_store_directory ,
132+ ):
133+ # Write out the config
134+ config = make_config_from_repo (
135+ out_of_date_repo .path , sha = out_of_date_repo .original_sha , check = False ,
136+ )
137+ write_config ('.' , config )
138+
139+ runner = Runner ('.' , C .CONFIG_FILE )
140+ before = open (C .CONFIG_FILE ).read ()
141+ # It will not update it, because the name doesn't match
142+ ret = autoupdate (runner , tags_only = False , repo = 'wrong_repo_name' )
143+ after = open (C .CONFIG_FILE ).read ()
144+ assert ret == 0
145+ assert before == after
146+
147+
127148def test_does_not_reformat (
128149 out_of_date_repo , mock_out_store_directory , in_tmpdir ,
129150):
0 commit comments