mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-09 23:10:24 +01:00
Unfortunately this breaks backward compatibility, but we have to do it, because current order is totally wrong. Configuring user with `dvc remote modify myssh user` is an explicit action and should have higher priority than implicit url. This is also important, since in the next patch in this PR we will introduce support for `port` configuration, that should also follow the same logic. Signed-off-by: Ruslan Kuprieiev <[email protected]>
25 lines
654 B
Python
25 lines
654 B
Python
import getpass
|
|
|
|
from unittest import TestCase
|
|
|
|
from dvc.remote.ssh import RemoteSSH
|
|
|
|
|
|
class TestRemoteSSH(TestCase):
|
|
def test_user(self):
|
|
url = 'ssh://127.0.0.1:/path/to/dir'
|
|
config = {'url': url}
|
|
remote = RemoteSSH(None, config)
|
|
self.assertEqual(remote.user, getpass.getuser())
|
|
|
|
user = 'test1'
|
|
url = 'ssh://{}@127.0.0.1:/path/to/dir'.format(user)
|
|
config = {'url': url}
|
|
remote = RemoteSSH(None, config)
|
|
self.assertEqual(remote.user, user)
|
|
|
|
user = 'test2'
|
|
config['user'] = user
|
|
remote = RemoteSSH(None, config)
|
|
self.assertEqual(remote.user, user)
|