Changed indention from tab to space

This commit is contained in:
Neocky 2022-06-16 21:26:43 +02:00
parent 7f2404f0cd
commit e229324117
7 changed files with 440 additions and 438 deletions

View File

@ -49,7 +49,7 @@ def get_version_id(plugin_id, plugin_version) -> str:
url = f"https://api.spiget.org/v2/resources/{plugin_id}/versions?size=100&sort=-name" url = f"https://api.spiget.org/v2/resources/{plugin_id}/versions?size=100&sort=-name"
version_list = api_do_request(url) version_list = api_do_request(url)
if response == None: if version_list == None:
return None return None
for plugins in version_list: for plugins in version_list:
plugin_update = plugins["name"] plugin_update = plugins["name"]

View File

@ -5,6 +5,7 @@ from src.utils import utilities
class TestCases(unittest.TestCase): class TestCases(unittest.TestCase):
def test_handle_regex_package_name(self): def test_handle_regex_package_name(self):
# Cropped name -> 'SUPERBPlugin'
plugin_name = "[1.13-5.49 ❤] >|> SUPERB Plugin <<💥| Now 150% OFF IN WINTER SALE IN SUMMER???" plugin_name = "[1.13-5.49 ❤] >|> SUPERB Plugin <<💥| Now 150% OFF IN WINTER SALE IN SUMMER???"
plugin_name_cropped = "SUPERBPlugin" plugin_name_cropped = "SUPERBPlugin"
result = plugin_downloader.handle_regex_package_name(plugin_name) result = plugin_downloader.handle_regex_package_name(plugin_name)
@ -12,15 +13,15 @@ class TestCases(unittest.TestCase):
def test_get_version_id(self): def test_get_version_id(self):
# 1234 -> "AntiPickup" in Version 1.4.1 # 21840 -> "Luckperms" in Version 5.4.30
result = plugin_downloader.get_version_id("1234", "1.4.1") result = plugin_downloader.get_version_id("28140", "5.4.30")
self.assertEqual(result, 43779) self.assertEqual(result, 455966)
def test_get_version_name(self): def test_get_version_name(self):
# 43779 -> "1.4.1" from AntiPickup # 455966 -> "5.4.30" from Luckperms
result = plugin_downloader.get_version_name("1234", 43779) result = plugin_downloader.get_version_name("28140", 455966)
self.assertEqual(result, "1.4.1") self.assertEqual(result, "5.4.30")
def test_get_download_path(self): def test_get_download_path(self):
@ -50,6 +51,7 @@ class TestCases(unittest.TestCase):
def test_convert_file_size_down(self): def test_convert_file_size_down(self):
# 100000 / 1024 = 97.66
result= utilities.convert_file_size_down(100000) result= utilities.convert_file_size_down(100000)
self.assertEqual(result, 97.66) self.assertEqual(result, 97.66)