Skip to content
Permalink
Browse files

Adding more tests

  • Loading branch information
Korusuke authored and reneeotten committed Jul 5, 2019
1 parent 9694e26 commit 0184241d5ec39d0585512fd706b6d1051743a602
@@ -22,6 +22,13 @@ def test_pkgname(self):
self.package.upt_pkg = upt.Package(name, '13.37')
self.assertEqual(self.package._pkgname(), expected_name)

def test_folder_name(self):
expected = ['p5-foo-bar', 'p5-foo-bar', 'p5-foo-bar', 'p5-foo-bar']
names = ['Foo::bar', 'foo::bar', 'Foo-bar', 'foo-bar']
for (name, expected_name) in zip(names, expected):
self.assertEqual(
self.package._normalized_macports_folder(name), expected_name)

@requests_mock.mock()
def test_missing_dist_pos1(self, requests):
expected = ' ../../authors/id/F/FO/FOOBAR/'
@@ -17,6 +17,32 @@ def test_pkgname(self):
self.package.upt_pkg = upt.Package(name, '13.37')
self.assertEqual(self.package._pkgname(), expected_name)

def test_folder_name(self):
expected = ['py-foo', 'py-py-foo', 'py-pyfoo', 'py-pyfoo']
names = ['foo', 'py-foo', 'pyfoo', 'pyFoo']
for (name, expected_name) in zip(names, expected):
self.assertEqual(
self.package._normalized_macports_folder(name), expected_name)

def test_py_root_name(self):
url_names = ['foo', 'Foo', 'Foo', 'foo']
pypi_names = ['foo', 'foo', 'pyFoo', 'py-Foo']
urls = [
'https://fakepypi.com/random/path/foo-13.37.tar.gz',
'https://fakepypi.com/random/path/Foo-13.37.tar.gz',
'https://fakepypi.com/random/path/Foo-13.37.tar.gz',
'https://fakepypi.com/random/path/foo-13.37.tar.gz'
]
for (url_name, pypi_name, url) in zip(url_names, pypi_names, urls):
self.package.upt_pkg = upt.Package(pypi_name, '13.37')
self.package.upt_pkg.archives = [upt.Archive(url)]
if url_name != pypi_name:
self.assertEqual(
self.package._python_root_name(), url_name)
else:
self.assertEqual(
self.package._python_root_name(), None)


if __name__ == '__main__':
unittest.main()
@@ -17,6 +17,13 @@ def test_pkgname(self):
self.package.upt_pkg = upt.Package(name, '13.37')
self.assertEqual(self.package._pkgname(), expected_name)

def test_folder_name(self):
expected = ['rb-foo', 'rb-foo', 'rb-foo-bar', 'rb-foo-bar']
names = ['Foo', 'foo', 'Foo-bar', 'foo-bar']
for (name, expected_name) in zip(names, expected):
self.assertEqual(
self.package._normalized_macports_folder(name), expected_name)


if __name__ == '__main__':
unittest.main()

0 comments on commit 0184241

Please sign in to comment.
You can’t perform that action at this time.