Commit 5c768e1c authored by Maximilian Dolling's avatar Maximilian Dolling

refined test

parent 6a70f984
......@@ -26,8 +26,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
import importlib.util
import unittest
spec = importlib.util.spec_from_file_location("module.name", "src/services/list-used-licenses/functions"
"/language_parser.py")
......@@ -43,12 +43,26 @@ spec.loader.exec_module(license_requester)
class TestLicenseRequesterFunctions(unittest.TestCase):
def test_python(self):
test_data = {'PyYAML': ['==5.3.1'],
'requests': ['==2.23.0']}
result_data = {'licenses': {'PyYAML': 'MIT',
'requests': 'Apache 2.0'},
'unknowns': {}}
test_data = {'PyYAML': ['==5.3.1',
'==4.0.0'],
'requests': ['==2.23.0'],
'pandas': ['>=1.0.3'],
'pandas2': ['<=1.0.3'],
'pandas3': ['~=1.0.3'],
'pandas4': ['!=1.0.3'],
'http://wxpython.org/wxPython_Phoenix-3.0.3.dev18.whl': ['==1.0.0'],
'scipy': ['unknown']}
result_data = {'licenses': {'requests': 'Apache 2.0'},
'unknowns': {'PyYAML': "unsupported number of version modifiers (['==5.3.1', '==4.0.0'])",
'pandas': 'unsupported version modifier (>=1.0.3)',
'pandas2': 'unsupported version modifier (<=1.0.3)',
'pandas3': 'unsupported version modifier (~=1.0.3)',
'pandas4': 'unsupported version modifier (!=1.0.3)',
'http://wxpython.org/wxPython_Phoenix-3.0.3.dev18.whl': 'unknown location',
'scipy': 'unknown version'}}
print(license_requester.get_python_libraries_license(test_data))
assert license_requester.get_python_libraries_license(test_data) == result_data
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment