mirror of
https://github.com/Neocky/pluGET.git
synced 2024-04-29 16:12:30 +00:00
Added tests for function in update_checker
This commit is contained in:
31
src/tests/test_plugin_updatechecker.py
Normal file
31
src/tests/test_plugin_updatechecker.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import unittest
|
||||
|
||||
from src.plugin import plugin_updatechecker
|
||||
|
||||
|
||||
class TestCases(unittest.TestCase):
|
||||
def test_get_plugin_file_name(self):
|
||||
plugin_file_name = "LuckPerms-5.4.30.jar"
|
||||
plugin_file_name_cropped = "LuckPerms"
|
||||
result = plugin_updatechecker.get_plugin_file_name(plugin_file_name)
|
||||
self.assertEqual(result, plugin_file_name_cropped)
|
||||
|
||||
def test_get_plugin_file_version(self):
|
||||
plugin_file_name = "LuckPerms-5.4.30.jar"
|
||||
plugin_version_cropped = "5.4.30"
|
||||
result = plugin_updatechecker.get_plugin_file_version(plugin_file_name)
|
||||
self.assertEqual(result, plugin_version_cropped)
|
||||
|
||||
def test_get_plugin_version_without_letters(self):
|
||||
plugin_version = "VERSIONv5.4.30"
|
||||
plugin_version_cropped = "5.4.30"
|
||||
result = plugin_updatechecker.get_plugin_version_without_letters(plugin_version)
|
||||
self.assertEqual(result, plugin_version_cropped)
|
||||
|
||||
def test_compare_plugin_version(self):
|
||||
result = plugin_updatechecker.compare_plugin_version("5.4.30", "5.4.0")
|
||||
result2 = plugin_updatechecker.compare_plugin_version("5.4.30", "8.7.60")
|
||||
result3 = plugin_updatechecker.compare_plugin_version("5.4.30", "5.4.30")
|
||||
self.assertEqual(result, True)
|
||||
self.assertEqual(result2, False)
|
||||
self.assertEqual(result3, False)
|
@@ -1,4 +1,5 @@
|
||||
import unittest
|
||||
|
||||
from src.plugin import plugin_downloader
|
||||
from src.utils import utilities
|
||||
|
||||
|
Reference in New Issue
Block a user