@@ -1170,8 +1170,8 @@ def test_dataset_clean_up_when_add_fails(runner, client):
11701170 assert not ref .is_symlink () and not ref .exists ()
11711171
11721172
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 ."""
11751175 runner .invoke (cli , ['dataset' , 'create' , 'my-dataset' ])
11761176
11771177 commit_sha_before = client .repo .head .object .hexsha
@@ -1192,3 +1192,27 @@ def test_add_removes_local_path_information(runner, client, directory_tree):
11921192 commit_sha_after = client .repo .head .object .hexsha
11931193 assert commit_sha_before == commit_sha_after
11941194 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