@@ -1170,8 +1170,8 @@ def test_dataset_clean_up_when_add_fails(runner, client):
1170
1170
assert not ref .is_symlink () and not ref .exists ()
1171
1171
1172
1172
1173
- def test_add_removes_local_path_information (runner , client , directory_tree ):
1174
- """Test local paths are removed when adding to a dataset ."""
1173
+ def test_avoid_empty_commits (runner , client , directory_tree ):
1174
+ """Test no empty commit is created when adding existing data ."""
1175
1175
runner .invoke (cli , ['dataset' , 'create' , 'my-dataset' ])
1176
1176
1177
1177
commit_sha_before = client .repo .head .object .hexsha
@@ -1192,3 +1192,27 @@ def test_add_removes_local_path_information(runner, client, directory_tree):
1192
1192
commit_sha_after = client .repo .head .object .hexsha
1193
1193
assert commit_sha_before == commit_sha_after
1194
1194
assert 'Error: There is nothing to commit.' in result .output
1195
+
1196
+
1197
+ def test_add_removes_credentials (runner , client ):
1198
+ """Test credentials are removed when adding to a dataset."""
1199
+ URL = 'https://username:password@example.com/index.html'
1200
+ result = runner .invoke (cli , ['dataset' , 'add' , '-c' , 'my-dataset' , URL ])
1201
+ assert 0 == result .exit_code
1202
+
1203
+ with client .with_dataset ('my-dataset' ) as dataset :
1204
+ file_ = dataset .files [0 ]
1205
+ assert file_ .url == 'https://example.com/index.html'
1206
+
1207
+
1208
+ def test_add_removes_local_path_information (runner , client , directory_tree ):
1209
+ """Test local paths are removed when adding to a dataset."""
1210
+ result = runner .invoke (
1211
+ cli , ['dataset' , 'add' , '-c' , 'my-dataset' , directory_tree .strpath ]
1212
+ )
1213
+ assert 0 == result .exit_code
1214
+
1215
+ with client .with_dataset ('my-dataset' ) as dataset :
1216
+ for file_ in dataset .files :
1217
+ assert file_ .url .startswith ('file://../' )
1218
+ assert file_ .url .endswith (file_ .name )
0 commit comments