def test_get_license_match_error(): with open(os.path.join('tst','license_test_unmatching.h'), 'r') as f: license = afqp_check.get_license(f) result = afqp_check.get_license_match_error(license, f.name) assert result == [] with open(os.path.join('tst', 'license_test_0.h'), 'r') as f: license = afqp_check.get_license(f) result = afqp_check.get_license_match_error(license, f.name) assert result != [] assert result[0].type == 'warning', '({}, {})'.format(result.type, result.info)
def test_get_license(): with open(os.path.join('tst','license_test_0.h'), 'r') as f: license = afqp_check.get_license(f) assert 'Amazon FreeRTOS' in license assert 'http://www.FreeRTOS.org' in license assert '#include \"dummy.h\"' not in license with open('tst/license_test_1.h', 'r') as f: license = afqp_check.get_license(f) assert 'Amazon FreeRTOS' in license assert 'http://www.FreeRTOS.org' in license assert '#ifndef DUMMY' not in license