Requirements for Code Publication
Maximilian Dolling
eScience Center - GFZ
18.05.2020
def GeT_SuMOf_int(Int A, int B): INT ResulT = A+B; reTurn ResulT
def get_sum_of_int(int A, int B):
int result = A+B
return result
def get_python_libraries_license(libraries_dict):
license_dict = {'licenses': {},
'unknowns': {}}
for lib in libraries_dict:
if lib[0:4] == 'http' or '.' in lib or '/' in lib:
license_dict['unknowns'][lib] = 'unknown location'
continue
def get_python_libraries_license(libraries_dict):
license_dict = {'licenses': {},
'unknowns': {}}
for lib in libraries_dict:
if lib[0:4] == 'http' or '.' in lib or '/' in lib:
license_dict['unknowns'][lib] = 'unknown location'
continue
def get_python_libraries_license(libraries_dict):
'''
This function requests the license of a library on PyPI.
It marks all libraries that are not hosted on PyPI as 'unknown license'.
Assumes requirements.txt is valid.
:param arg1: dict of used libraries and their versions
:type arg1: dict{lib_name: list[version1, version2]}
:return: dict of used libraries and their license
:rtype: dict{lib_name: list[license1, license2]}
'''
license_dict = {'licenses': {},
'unknowns': {}}
for lib in libraries_dict:
# handle not hosted on PyPI
if lib[0:4] == 'http' or '.' in lib or '/' in lib:
license_dict['unknowns'][lib] = 'unknown location'
continue
#!/usr/bin/env bash
# change to path of this script
# shellcheck disable=SC2046
cd $( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd ) || exit 1
# remove db files from local runs
rm -rf ./service_database/app/migrations
rm -rf ./service_database/app/app.db
# set device (enp0s31f6) ip as environment variable
HOST_IP=$(ip addr show enp0s31f6 | grep 'inet ' | awk '{print $2}' | cut -f1 -d'/')
# put host ip into global environment variables conf
sed "s/HOST_IP=/HOST_IP=$HOST_IP/g" config/global.env > global.env
# start images with docker compose
docker-compose up -d --build
def multiply(int A, int B): return A**B
def test_multiply(): assert multiply(3,13) == 39 assert raiseException(multiply(1.0, 2), wrongTypeException)
def test_login_missing_field(selenium):
"""
test login function with missing input and alerts
"""
selenium.delete_all_cookies()
"""
no password
"""
selenium.get(app_url)
assert 'RSE@GFZ' in selenium.title
assert selenium.current_url == app_url + '/'
username = selenium.find_element_by_name('username')
submit = selenium.find_element_by_name('submit')
username.clear()
username.send_keys("foo")
submit.click()
warning = selenium.find_element_by_id('password_error')