def test_generate_attribution_verification(self): expected = (u'name,version,copyright,dje_license_name\n' u'Apache HTTP Server,2.4.3,,') test_file = join(TESTDATA_DIR, 'attrib/attrib.ABOUT') collector = Collector(test_file) test_path = get_temp_file('test.csv') collector.generate_attribution(limit_to=[''], verification=test_path) with open(test_path, 'rU') as f: self.assertEqual(f.read().rstrip(), expected)
def test_generate_attribution_with_limit_to(self): f = open(join(TESTDATA_DIR, 'attrib/attrib.html')) expected = f.read() test_file = join(TESTDATA_DIR, 'attrib/') collector = Collector(test_file) result = collector.generate_attribution(limit_to=['/attrib.ABOUT']) # Strip all the white spaces self.assertEqual(re.sub(r'\s+', '', expected), re.sub(r'\s+', '', result))
def test_generate_attribution_with_custom_template(self): expected = (u'notice_text:' u'version:2.4.3' u'about_resource:httpd-2.4.3.tar.gz' u'name:Apache HTTP Serverlicense_text:') test_file = join(TESTDATA_DIR, 'attrib/attrib.ABOUT') collector = Collector(test_file) template = join(TESTDATA_DIR, 'attrib/test.template') result = collector.generate_attribution(template, limit_to=['']) self.assertEqual(expected, result)