Skip to content

Commit eb6a9a7

Browse files
committed
Test for not overwritten the original value of license_file
Signed-off-by: Chin Yeung Li <[email protected]>
1 parent 361f202 commit eb6a9a7

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

tests/test_gen.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,23 @@ def test_generate(self):
159159
u' line\n')
160160
assert expected == in_mem_result
161161

162+
def test_generate_not_overwrite_original_license_file(self):
163+
location = get_test_loc('gen/inv5.csv')
164+
base_dir = get_temp_dir()
165+
license_notice_text_location = None
166+
fetch_license = ['url', 'lic_key']
167+
168+
errors, abouts = gen.generate(location, base_dir, license_notice_text_location, fetch_license)
169+
170+
in_mem_result = [a.dumps(with_absent=False, with_empty=False)
171+
for a in abouts][0]
172+
expected = (u'about_resource: .\n'
173+
u'name: AboutCode\n'
174+
u'about_resource_path: .\n'
175+
u'version: 0.11.0\n'
176+
u'license_file: this.LICENSE\n')
177+
assert expected == in_mem_result
178+
162179
def test_deduplicate(self):
163180
items = ['a', 'b', 'd', 'b', 'c', 'a']
164181
expected = ['a', 'b', 'd', 'c']

tests/testdata/gen/inv5.csv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
about_file_path,about_resource,name,version,download_url,description,homepage_url,notes,license_name,license_file,license_url,copyright,notice_file,notice_url,redistribute,attribute,track_change,modified,changelog_file,owner,owner_url,contact,author,vcs_tool,vcs_repository,vcs_path,vcs_tag,vcs_branch,vcs_revision,checksum_md5,checksum_sha1,spec_version,custom1
2+
inv/this.ABOUT,.,AboutCode,0.11.0,,,,,,this.LICENSE,,,,,,,,,,,,,,,,,,,,,,,"multi
3+
line"

0 commit comments

Comments
 (0)