Merge lp:~pfalcon/linaro-license-protection/revamp-buildinfo-tests into lp:~linaro-automation/linaro-license-protection/trunk

Proposed by Paul Sokolovsky
Status: Superseded
Proposed branch: lp:~pfalcon/linaro-license-protection/revamp-buildinfo-tests
Merge into: lp:~linaro-automation/linaro-license-protection/trunk
Diff against target: 42 lines (+17/-5)
2 files modified
license_protected_downloads/tests/test_buildinfo.py (+16/-5)
license_protected_downloads/tests/testserver_root/build-info/no-build-info/file (+1/-0)
To merge this branch: bzr merge lp:~pfalcon/linaro-license-protection/revamp-buildinfo-tests
Reviewer Review Type Date Requested Status
Данило Шеган (community) Needs Fixing
Review via email: mp+149541@code.launchpad.net

This proposal has been superseded by a proposal from 2013-02-20.

Description of the change

Revamp failure in linaro-license-protection's testsuite. Individual commits has detailed description of changes and reasons behind them.

To post a comment you must log in.
Revision history for this message
Данило Шеган (danilo) wrote :

This looks good.

review: Approve
163. By Paul Sokolovsky

Test separately for querying subdir access and access when no BUILD-INFO.txt.

Previous test_readFile_nonFile() was really confusing, there're two separate
cases to test for.

Also, make conclusions from previous wrong test patch due to presence of stray
BUILD-INFO.txt on local system: the real problem is not using actual dirs for
testdata, but trying to (ab)use source files directory as testdata: don't do
that, have each for its own purpose (source directory may contain arbitrary
files during development, but test corpus is just that).

Revision history for this message
Данило Шеган (danilo) :
review: Needs Fixing

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'license_protected_downloads/tests/test_buildinfo.py'
--- license_protected_downloads/tests/test_buildinfo.py 2013-01-30 10:46:11 +0000
+++ license_protected_downloads/tests/test_buildinfo.py 2013-02-20 13:12:27 +0000
@@ -14,15 +14,26 @@
14 self.buildinfo_file_path = os.path.join(THIS_DIRECTORY,14 self.buildinfo_file_path = os.path.join(THIS_DIRECTORY,
15 "BUILD-INFO.txt")15 "BUILD-INFO.txt")
1616
17 def test_readFile_nonFile(self):17 def test_no_buildinfo(self):
18 file_path = THIS_DIRECTORY + \
19 '/testserver_root/build-info/no-build-info/file'
18 with self.assertRaises(IOError):20 with self.assertRaises(IOError):
19 BuildInfo("license_protected_downloads")21 BuildInfo(file_path)
2022
21 def test_readFile_nonexistentFile(self):23 def test_apply_to_dir(self):
24 dir_path = THIS_DIRECTORY + \
25 '/testserver_root/build-info/subdir'
26 build_info = BuildInfo(dir_path)
27 self.assertEquals(build_info.getInfoForFile(),
28 [{'build-name': 'landing-protected',
29 'license-type': 'protected',
30 'openid-launchpad-teams': 'linaro'}])
31
32 def test_apply_to_nonexistent_file(self):
22 with self.assertRaises(IOError):33 with self.assertRaises(IOError):
23 BuildInfo("nonexistent.file")34 BuildInfo("nonexistent.file")
2435
25 def test_readFile_File(self):36 def test_apply_to_file(self):
26 build_info = BuildInfo(self.buildinfo_file_path)37 build_info = BuildInfo(self.buildinfo_file_path)
2738
28 self.assertIn("Files-Pattern: *.txt", build_info.lines)39 self.assertIn("Files-Pattern: *.txt", build_info.lines)
2940
=== added directory 'license_protected_downloads/tests/testserver_root/build-info/no-build-info'
=== added file 'license_protected_downloads/tests/testserver_root/build-info/no-build-info/file'
--- license_protected_downloads/tests/testserver_root/build-info/no-build-info/file 1970-01-01 00:00:00 +0000
+++ license_protected_downloads/tests/testserver_root/build-info/no-build-info/file 2013-02-20 13:12:27 +0000
@@ -0,0 +1,1 @@
1just file

Subscribers

People subscribed via source and target branches