Пример #1
0
 def test_translate_iso_path(self, mock_mkdtemp, mock_command):
     mock_mkdtemp.return_value = '/tmp/foo'
     uri = Uri('iso:///image/CDs/openSUSE-13.2-DVD-x86_64.iso', 'yast2')
     result = uri.translate()
     mock_command.assert_called_once_with(
         ['mount', '/image/CDs/openSUSE-13.2-DVD-x86_64.iso', '/tmp/foo'])
     assert result == '/tmp/foo'
Пример #2
0
 def test_translate_iso_path(self, mock_mkdtemp, mock_command):
     mock_mkdtemp.return_value = '/tmp/foo'
     uri = Uri('iso:///image/CDs/openSUSE-13.2-DVD-x86_64.iso', 'yast2')
     result = uri.translate()
     mock_command.assert_called_once_with(
         ['mount', '/image/CDs/openSUSE-13.2-DVD-x86_64.iso', '/tmp/foo']
     )
     assert result == '/tmp/foo'
Пример #3
0
 def test_translate_unsupported_style(self):
     uri = Uri('ms://foo', 'rpm-md')
     uri.translate()
Пример #4
0
 def test_is_remote_raises_type_error(self):
     uri = Uri('xtp://download.example.com', 'rpm-md')
     uri.is_remote()
Пример #5
0
 def test_translate_unknown_style(self):
     uri = Uri('xxx', 'rpm-md')
     uri.translate()
Пример #6
0
 def test_translate_suse_buildservice_path(self):
     uri = Uri('suse://openSUSE:13.2/standard', 'yast2')
     assert uri.translate() == \
         '/usr/src/packages/SOURCES/repos/openSUSE:13.2/standard'
Пример #7
0
 def test_is_remote_raises_type_error(self):
     uri = Uri('xtp://download.example.com', 'rpm-md')
     uri.is_remote()
Пример #8
0
 def test_translate_ibs_project(self):
     uri = Uri('ibs://Devel:PubCloud/SLE_12_GA', 'rpm-md')
     assert uri.translate() == \
         'http://download.suse.de/ibs/Devel:/PubCloud/SLE_12_GA'
Пример #9
0
 def test_translate_unsupported_style(self):
     uri = Uri('ms://foo', 'rpm-md')
     uri.translate()
Пример #10
0
 def test_translate_dir_path(self):
     uri = Uri('dir:///some/path', 'rpm-md')
     assert uri.translate() == '/some/path'
Пример #11
0
 def test_translate_http_path(self):
     uri = Uri('http://example.com/foo', 'rpm-md')
     assert uri.translate() == 'http://example.com/foo'
Пример #12
0
 def test_translate_obs_distro(self):
     uri = Uri('obs://13.2/repo/oss', 'yast2')
     assert uri.translate() == \
         'http://download.opensuse.org/distribution/13.2/repo/oss'
Пример #13
0
 def test_translate_obs_project(self):
     uri = Uri('obs://Virt:Appliances/SLE_12', 'rpm-md')
     assert uri.translate() == \
         'http://download.opensuse.org/repositories/Virt:Appliances/SLE_12'
Пример #14
0
 def test_translate_ibs_project(self):
     uri = Uri('ibs://Devel:PubCloud/SLE_12_GA', 'rpm-md')
     assert uri.translate() == \
         'http://download.suse.de/ibs/Devel:/PubCloud/SLE_12_GA'
Пример #15
0
 def test_alias(self):
     uri = Uri('https://example.com', 'rpm-md')
     assert uri.alias() == hashlib.md5('https://example.com').hexdigest()
Пример #16
0
 def test_is_remote(self):
     uri = Uri('https://example.com', 'rpm-md')
     assert uri.is_remote() is True
     uri = Uri('dir:///path/to/repo', 'rpm-md')
     assert uri.is_remote() is False
Пример #17
0
 def test_is_remote(self):
     uri = Uri('https://example.com', 'rpm-md')
     assert uri.is_remote() is True
     uri = Uri('dir:///path/to/repo', 'rpm-md')
     assert uri.is_remote() is False
Пример #18
0
 def test_translate_obs_project(self):
     uri = Uri('obs://Virt:Appliances/SLE_12', 'rpm-md')
     assert uri.translate() == \
         'http://download.opensuse.org/repositories/Virt:Appliances/SLE_12'
Пример #19
0
 def test_alias(self):
     uri = Uri('https://example.com', 'rpm-md')
     assert uri.alias() == hashlib.md5('https://example.com').hexdigest()
Пример #20
0
 def test_translate_http_path(self):
     uri = Uri('http://example.com/foo', 'rpm-md')
     assert uri.translate() == 'http://example.com/foo'
Пример #21
0
 def test_translate_obs_distro(self):
     uri = Uri('obs://13.2/repo/oss', 'yast2')
     assert uri.translate() == \
         'http://download.opensuse.org/distribution/13.2/repo/oss'
Пример #22
0
 def test_translate_unknown_style(self):
     uri = Uri('xxx', 'rpm-md')
     uri.translate()
Пример #23
0
 def test_translate_dir_path(self):
     uri = Uri('dir:///some/path', 'rpm-md')
     assert uri.translate() == '/some/path'
Пример #24
0
 def test_translate_suse_buildservice_path(self):
     uri = Uri('suse://openSUSE:13.2/standard', 'yast2')
     assert uri.translate() == \
         '/usr/src/packages/SOURCES/repos/openSUSE:13.2/standard'
Пример #25
0
 def test_destructor(self, mock_mkdtemp, mock_command):
     mock_mkdtemp.return_value = '/tmp/foo'
     uri = Uri('iso:///image/CDs/openSUSE-13.2-DVD-x86_64.iso', 'yast2')
     result = uri.translate()
     mock_command.side_effect = KeyError
     del uri
Пример #26
0
 def test_is_remote_raises_style_error(self):
     uri = Uri('xxx', 'rpm-md')
     uri.is_remote()
Пример #27
0
 def test_destructor(self, mock_mkdtemp, mock_command):
     mock_mkdtemp.return_value = '/tmp/foo'
     uri = Uri('iso:///image/CDs/openSUSE-13.2-DVD-x86_64.iso', 'yast2')
     result = uri.translate()
     mock_command.side_effect = KeyError
     del uri
Пример #28
0
 def test_is_remote_raises_style_error(self):
     uri = Uri('xxx', 'rpm-md')
     uri.is_remote()