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
1=== modified file 'license_protected_downloads/tests/test_buildinfo.py'
2--- license_protected_downloads/tests/test_buildinfo.py 2013-01-30 10:46:11 +0000
3+++ license_protected_downloads/tests/test_buildinfo.py 2013-02-20 13:12:27 +0000
4@@ -14,15 +14,26 @@
5 self.buildinfo_file_path = os.path.join(THIS_DIRECTORY,
6 "BUILD-INFO.txt")
7
8- def test_readFile_nonFile(self):
9+ def test_no_buildinfo(self):
10+ file_path = THIS_DIRECTORY + \
11+ '/testserver_root/build-info/no-build-info/file'
12 with self.assertRaises(IOError):
13- BuildInfo("license_protected_downloads")
14-
15- def test_readFile_nonexistentFile(self):
16+ BuildInfo(file_path)
17+
18+ def test_apply_to_dir(self):
19+ dir_path = THIS_DIRECTORY + \
20+ '/testserver_root/build-info/subdir'
21+ build_info = BuildInfo(dir_path)
22+ self.assertEquals(build_info.getInfoForFile(),
23+ [{'build-name': 'landing-protected',
24+ 'license-type': 'protected',
25+ 'openid-launchpad-teams': 'linaro'}])
26+
27+ def test_apply_to_nonexistent_file(self):
28 with self.assertRaises(IOError):
29 BuildInfo("nonexistent.file")
30
31- def test_readFile_File(self):
32+ def test_apply_to_file(self):
33 build_info = BuildInfo(self.buildinfo_file_path)
34
35 self.assertIn("Files-Pattern: *.txt", build_info.lines)
36
37=== added directory 'license_protected_downloads/tests/testserver_root/build-info/no-build-info'
38=== added file 'license_protected_downloads/tests/testserver_root/build-info/no-build-info/file'
39--- license_protected_downloads/tests/testserver_root/build-info/no-build-info/file 1970-01-01 00:00:00 +0000
40+++ license_protected_downloads/tests/testserver_root/build-info/no-build-info/file 2013-02-20 13:12:27 +0000
41@@ -0,0 +1,1 @@
42+just file

Subscribers

People subscribed via source and target branches