Commit f33a5275 authored by Maximilian Dolling's avatar Maximilian Dolling

bak

parent 951ba65a
......@@ -27,7 +27,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
# from src.services.generate_report.functions import helper
import importlib.util
spec = importlib.util.spec_from_file_location("module.name", "src/services/generate-report/functions/helper.py")
......
......@@ -27,23 +27,29 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
import importlib.util
spec = importlib.util.spec_from_file_location("module.name", "src/services/list-used-licenses/functions"
"/language_parser.py")
language_parser = importlib.util.module_from_spec(spec)
spec.loader.exec_module(language_parser)
class TestLanguageParserFunctions(unittest.TestCase):
spec = importlib.util.spec_from_file_location("module.name", "src/services/list-used-licenses/functions"
"/license_requester.py")
license_requester = importlib.util.module_from_spec(spec)
spec.loader.exec_module(license_requester)
def test_upper(self):
self.assertEqual('foo'.upper(), 'FOO')
def test_isupper(self):
self.assertTrue('FOO'.isupper())
self.assertFalse('Foo'.isupper())
class TestLicenseRequesterFunctions(unittest.TestCase):
def test_split(self):
s = 'hello world'
self.assertEqual(s.split(), ['hello', 'world'])
# check that s.split fails when the separator is not a string
with self.assertRaises(TypeError):
s.split(2)
def test_python(self):
test_data = {'PyYAML': ['==5.3.1'],
'requests': ['==2.23.0']}
result_data = {'licenses': {'PyYAML': 'MIT',
'requests': 'Apache 2.0'},
'unknowns': {}}
assert license_requester.get_python_libraries_license(test_data) == result_data
if __name__ == '__main__':
......
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