Merge lp:~gesha/linaro-license-protection/per-file-EULA into lp:~linaro-automation/linaro-license-protection/trunk

Proposed by Georgy Redkozubov
Status: Merged
Merged at revision: 60
Proposed branch: lp:~gesha/linaro-license-protection/per-file-EULA
Merge into: lp:~linaro-automation/linaro-license-protection/trunk
Diff against target: 451 lines (+192/-75)
14 files modified
.htaccess (+10/-34)
android/images/MANIFEST (+1/-0)
android/images/origen-blob.txt (+1/-0)
android/images/snowball-blob.txt (+1/-0)
android/~linaro-android/staging-origen/test.txt (+1/-1)
android/~linaro-android/staging-panda/test.txt (+1/-1)
android/~linaro-android/staging-snowball/173/target/product/snowball/test.txt (+1/-1)
android/~linaro-android/staging-snowball/173/test.txt (+1/-0)
licenses/license.php (+117/-16)
licenses/linaro.html (+1/-6)
licenses/linaro.txt (+1/-0)
licenses/samsung.html (+1/-5)
licenses/ste.html (+0/-5)
testing/test_click_through_license.py (+55/-6)
To merge this branch: bzr merge lp:~gesha/linaro-license-protection/per-file-EULA
Reviewer Review Type Date Requested Status
Данило Шеган (community) Approve
Review via email: mp+103238@code.launchpad.net

Description of the change

This branch adds per file EULA support for downloads click-through license protection.

To post a comment you must log in.
61. By Georgy Redkozubov

Fixed indentation

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

Looks good, it'd be nice to have a test for dirs only containing other dirs.

review: Approve
62. By Georgy Redkozubov

Added test for directory containing only directories

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.htaccess'
--- .htaccess 2012-03-27 13:50:19 +0000
+++ .htaccess 2012-04-24 10:59:21 +0000
@@ -31,6 +31,7 @@
31RewriteCond %{REQUEST_URI} /licenses/ste.html$ [OR]31RewriteCond %{REQUEST_URI} /licenses/ste.html$ [OR]
32RewriteCond %{REQUEST_URI} /licenses/samsung.html$ [OR]32RewriteCond %{REQUEST_URI} /licenses/samsung.html$ [OR]
33RewriteCond %{REQUEST_URI} /licenses/linaro.html$ [OR]33RewriteCond %{REQUEST_URI} /licenses/linaro.html$ [OR]
34RewriteCond %{REQUEST_URI} /licenses/nolicense.html$ [OR]
34RewriteCond %{REQUEST_URI} /licenses/license.php$35RewriteCond %{REQUEST_URI} /licenses/license.php$
35RewriteCond %{HTTP_COOKIE} downloadrequested36RewriteCond %{HTTP_COOKIE} downloadrequested
36RewriteCond %{HTTP_COOKIE} !licenseaccepted=true37RewriteCond %{HTTP_COOKIE} !licenseaccepted=true
@@ -45,13 +46,11 @@
45RewriteCond %{HTTP_COOKIE} !downloadrequested=(.*)46RewriteCond %{HTTP_COOKIE} !downloadrequested=(.*)
46RewriteRule .* / [R,L]47RewriteRule .* / [R,L]
4748
48## Exception for <iframe>
49RewriteCond %{REQUEST_URI} ^.*/EULA.txt$
50RewriteRule .* - [L]
51
52## If there is a cookie indicating license has been accepted, pass through.49## If there is a cookie indicating license has been accepted, pass through.
50## Unset it to be able to process several protected files in the same dir
53RewriteCond %{HTTP_COOKIE} licenseaccepted=true51RewriteCond %{HTTP_COOKIE} licenseaccepted=true
54RewriteRule .* - [L]52RewriteCond %{HTTP_COOKIE} downloadrequested=([^\;]*\/)([^/\;]*)
53RewriteRule .* - [CO=licenseaccepted:INVALID:;:-1:%1,L]
5554
56## When license is accepted, set the cookie.55## When license is accepted, set the cookie.
57RewriteCond %{REQUEST_URI} licenses/.*-accepted.html$56RewriteCond %{REQUEST_URI} licenses/.*-accepted.html$
@@ -72,36 +71,13 @@
72RewriteCond %{ENV:LP_DOWNLOAD_DIR}/OPEN-EULA.txt -f 71RewriteCond %{ENV:LP_DOWNLOAD_DIR}/OPEN-EULA.txt -f
73RewriteRule .* - [L]72RewriteRule .* - [L]
7473
74## Unset cookie indicating redirect from license.php
75RewriteCond %{HTTP_COOKIE} redirectlicensephp=yes
76RewriteRule .* - [CO=redirectlicensephp:INVALID:;:-1,L]
77
75## Redirect to the Samsung license file protected builds.78## Redirect to the Samsung license file protected builds.
76RewriteCond %{REQUEST_FILENAME} -d79RewriteCond %{REQUEST_URI} !^/$
77RewriteCond %{REQUEST_FILENAME} .*origen.*80RewriteRule .* /licenses/license.php [CO=downloadrequested:%{REQUEST_URI}:.%{ENV:CO_DOMAIN},L,R]
78RewriteCond %{REQUEST_FILENAME}/EULA.txt -f
79RewriteRule .* /licenses/license.php?samsung [CO=downloadrequested:%{REQUEST_URI}:.%{ENV:CO_DOMAIN},R,L]
80
81RewriteCond %{REQUEST_FILENAME} -f
82RewriteCond %{REQUEST_FILENAME} .*origen.*
83RewriteCond %{ENV:LP_DOWNLOAD_DIR}/EULA.txt -f
84RewriteRule .* /licenses/license.php?samsung [CO=downloadrequested:%{REQUEST_URI}:.%{ENV:CO_DOMAIN},R,L]
85
86## Redirect to the ST-E license file protected builds.
87RewriteCond %{REQUEST_FILENAME} -d
88RewriteCond %{REQUEST_FILENAME} .*snowball.*
89RewriteCond %{REQUEST_FILENAME}/EULA.txt -f
90RewriteRule .* /licenses/license.php?ste [CO=downloadrequested:%{REQUEST_URI}:.%{ENV:CO_DOMAIN},R,L]
91
92RewriteCond %{REQUEST_FILENAME} -f
93RewriteCond %{REQUEST_FILENAME} .*snowball.*
94RewriteCond %{ENV:LP_DOWNLOAD_DIR}/EULA.txt -f
95RewriteRule .* /licenses/license.php?ste [CO=downloadrequested:%{REQUEST_URI}:.%{ENV:CO_DOMAIN},R,L]
96
97## Redirect to the Linaro license file protected builds.
98RewriteCond %{REQUEST_FILENAME} -d
99RewriteCond %{REQUEST_FILENAME}/EULA.txt -f
100RewriteRule .* /licenses/license.php?linaro [CO=downloadrequested:%{REQUEST_URI}:.%{ENV:CO_DOMAIN},R,L]
101
102RewriteCond %{REQUEST_FILENAME} -f
103RewriteCond %{ENV:LP_DOWNLOAD_DIR}/EULA.txt -f
104RewriteRule .* /licenses/license.php?linaro [CO=downloadrequested:%{REQUEST_URI}:.%{ENV:CO_DOMAIN},R,L]
10581
106## Return "Permission denied" if no EULA/OPEN-EULA exists82## Return "Permission denied" if no EULA/OPEN-EULA exists
107RewriteCond %{REQUEST_URI} !^/$83RewriteCond %{REQUEST_URI} !^/$
10884
=== added directory 'android/images'
=== added file 'android/images/MANIFEST'
--- android/images/MANIFEST 1970-01-01 00:00:00 +0000
+++ android/images/MANIFEST 2012-04-24 10:59:21 +0000
@@ -0,0 +1,1 @@
1MANIFEST
0\ No newline at end of file2\ No newline at end of file
13
=== added file 'android/images/origen-blob.EULA.txt.samsung'
=== added file 'android/images/origen-blob.txt'
--- android/images/origen-blob.txt 1970-01-01 00:00:00 +0000
+++ android/images/origen-blob.txt 2012-04-24 10:59:21 +0000
@@ -0,0 +1,1 @@
1This is protected with click-through Samsung license.
0\ No newline at end of file2\ No newline at end of file
13
=== added file 'android/images/snowball-blob.EULA.txt.ste'
=== added file 'android/images/snowball-blob.txt'
--- android/images/snowball-blob.txt 1970-01-01 00:00:00 +0000
+++ android/images/snowball-blob.txt 2012-04-24 10:59:21 +0000
@@ -0,0 +1,1 @@
1This is protected with click-through ST-E license.
0\ No newline at end of file2\ No newline at end of file
13
=== modified file 'android/~linaro-android/staging-origen/test.txt'
--- android/~linaro-android/staging-origen/test.txt 2011-12-09 16:08:16 +0000
+++ android/~linaro-android/staging-origen/test.txt 2012-04-24 10:59:21 +0000
@@ -1,1 +1,1 @@
1This is a protected with click-through Samsung license.1This is protected with click-through Samsung license.
22
=== modified file 'android/~linaro-android/staging-panda/test.txt'
--- android/~linaro-android/staging-panda/test.txt 2012-03-27 09:53:11 +0000
+++ android/~linaro-android/staging-panda/test.txt 2012-04-24 10:59:21 +0000
@@ -1,1 +1,1 @@
1This is a protected with click-through Linaro license.1This is protected with click-through Linaro license.
22
=== added file 'android/~linaro-android/staging-snowball/173/OPEN-EULA.txt'
=== modified file 'android/~linaro-android/staging-snowball/173/target/product/snowball/test.txt'
--- android/~linaro-android/staging-snowball/173/target/product/snowball/test.txt 2012-03-27 13:57:57 +0000
+++ android/~linaro-android/staging-snowball/173/target/product/snowball/test.txt 2012-04-24 10:59:21 +0000
@@ -1,1 +1,1 @@
1This is a protected with click-through ST-E license.1This is protected with click-through ST-E license.
22
=== added file 'android/~linaro-android/staging-snowball/173/test.txt'
--- android/~linaro-android/staging-snowball/173/test.txt 1970-01-01 00:00:00 +0000
+++ android/~linaro-android/staging-snowball/173/test.txt 2012-04-24 10:59:21 +0000
@@ -0,0 +1,1 @@
1This is always available.
02
=== modified file 'licenses/license.php'
--- licenses/license.php 2012-04-20 16:00:26 +0000
+++ licenses/license.php 2012-04-24 10:59:21 +0000
@@ -1,18 +1,119 @@
1<?php1<?php
2 $down = $_COOKIE["downloadrequested"];2// Get list of files into array to process them later.
3 $lic = $_SERVER["QUERY_STRING"];3// Used to find special licenses and dirs with only subdirs.
4 $host = $_SERVER["HTTP_HOST"];4function getFilesList($dirname)
5 $doc = $_SERVER["DOCUMENT_ROOT"];5{
6 $fn = $doc.$down;6 $files = array();
7 if (file_exists($fn) and is_file($fn)) {7 if ($handle = opendir($dirname)) {
8 $repl = dirname($down);8 while ($handle && false !== ($entry = readdir($handle))) {
9 } else {9 if ($entry != "." && $entry != ".." && !is_dir($dirname.$entry) && !is_link($dirname.$entry)) {
10 $repl = $down;10 $files[] = $entry;
11 }11 }
1212 }
13 $template_content = file_get_contents($doc."/licenses/".$lic.".html");13 }
14 $eula_content = file_get_contents($doc."/licenses/".$lic.".txt");14 closedir($handle);
1515 return $files;
16 $out = str_replace("EULA.txt", $eula_content, $template_content);16}
17 echo $out;17
18// Get array of file name and extension from full filename.
19function splitFilename($filename)
20{
21 $pos = strpos($filename, '.');
22 if ($pos === false) { // dot is not found in the filename
23 return array($filename, ''); // no extension
24 } else {
25 $basename = substr($filename, 0, $pos);
26 $extension = substr($filename, $pos+1);
27 return array($basename, $extension);
28 }
29}
30
31// Find special EULA based on filename template.
32function findSpecialEULA($fl, $pattern)
33{
34 if (!empty($fl)) {
35 foreach ($fl as $f) {
36 if (preg_match($pattern, $f, $matches)) {
37 return $f;
38 }
39 }
40 }
41 return false;
42}
43
44// Get license theme name from EULA filename.
45function getTheme($eula, $down)
46{
47 if ($eula != 'EULA.txt') { // Special EULA file was found
48 $theme = array_pop(explode(".", $eula));
49 } else { // No special EULA file was found
50 $eula = "EULA.txt";
51 if (preg_match("/.*snowball.*/", $down)) {
52 $theme = "ste";
53 } elseif (preg_match("/.*origen.*/", $down)) {
54 $theme = "samsung";
55 } else {
56 $theme = "linaro";
57 }
58 }
59 return $theme;
60}
61
62$down = $_COOKIE["downloadrequested"];
63$host = $_SERVER["HTTP_HOST"];
64$doc = $_SERVER["DOCUMENT_ROOT"];
65$fn = $doc.$down; // Filename on server
66$flist = array();
67$eula = '';
68
69if (file_exists($fn) and is_file($fn)) { // Requested download is file
70 $search_dir = dirname($fn);
71 $repl = dirname($down);
72 $name_only = splitFilename(basename($down));
73} elseif (is_dir($fn)) { // Requested download is directory
74 $search_dir = $fn;
75 $repl = $down;
76 $name_only = array();
77} else { // Requested download not found on server
78 header("HTTP/1.0 404 Not Found");
79 header("Status: 404");
80 echo "<h1>404 Not Found</h1>";
81 echo "The requested URL was not found on this server.";
82 exit;
83}
84
85$flist = getFilesList($search_dir);
86
87if (!empty($name_only)) {
88 $pattern = "/^".$name_only[0]."\.EULA\.txt.*/";
89 $eula = findSpecialEULA($flist, $pattern);
90}
91
92if (is_file($doc."/".$repl."/".$eula)) { // Special EULA found
93 $theme = getTheme($eula, $down);
94} elseif (is_file($doc."/".$repl."/EULA.txt")) { // No special EULA found
95 $theme = getTheme("EULA.txt", $down);
96} elseif (file_exists($fn) and findSpecialEULA($flist, "/.*EULA.txt.*/")) {
97 // If file is requested but no special EULA for it and no EULA.txt is present,
98 // look for any EULA and if found decide that current file is not protected.
99 setcookie("redirectlicensephp", "yes", 0, "/");
100 header("Location: ".$down);
101 exit;
102} elseif (empty($flist)) { // Directory contains only subdirs
103 setcookie("redirectlicensephp", "yes", 0, "/");
104 header("Location: ".$down);
105 exit;
106} else { // No special EULA, no EULA.txt, no OPEN-EULA.txt found
107 header("HTTP/1.1 403 Forbidden");
108 header("Status: 403");
109 echo "<h1>Forbidden</h1>";
110 echo "You don't have permission to access ".$down." on this server.";
111 exit;
112}
113
114$template_content = file_get_contents($doc."/licenses/".$theme.".html");
115$eula_content = file_get_contents($doc."/licenses/".$theme.".txt");
116
117$out = str_replace("EULA.txt", $eula_content, $template_content);
118echo $out;
18?>119?>
19120
=== modified file 'licenses/linaro.html'
--- licenses/linaro.html 2012-03-27 13:57:57 +0000
+++ licenses/linaro.html 2012-04-24 10:59:21 +0000
@@ -82,11 +82,6 @@
82 #actions .button-accept:hover {82 #actions .button-accept:hover {
83 background: #9c5;83 background: #9c5;
84 }84 }
85 iframe#eula {
86 width: 100%;
87 height: 100%;
88 scrolling: auto;
89 }
90</style>85</style>
91</head>86</head>
92<body>87<body>
@@ -101,7 +96,7 @@
101<div id="content">96<div id="content">
10297
103<div id="license-text">98<div id="license-text">
104<iframe id="eula" frameborder=0 src="EULA.txt"></iframe>99EULA.txt
105</div><!-- license-text -->100</div><!-- license-text -->
106101
107<div id="actions">102<div id="actions">
108103
=== added file 'licenses/linaro.txt'
--- licenses/linaro.txt 1970-01-01 00:00:00 +0000
+++ licenses/linaro.txt 2012-04-24 10:59:21 +0000
@@ -0,0 +1,1 @@
1Linaro license.
0\ No newline at end of file2\ No newline at end of file
13
=== modified file 'licenses/samsung.html'
--- licenses/samsung.html 2012-04-20 16:00:26 +0000
+++ licenses/samsung.html 2012-04-24 10:59:21 +0000
@@ -45,6 +45,7 @@
45 color: black;45 color: black;
46 margin: 2em;46 margin: 2em;
47 padding: 2em;47 padding: 2em;
48 overflow: scroll;
48 text-align: left;49 text-align: left;
49 -moz-border-radius: 10px;50 -moz-border-radius: 10px;
50 -webkit-border-radius: 10px;51 -webkit-border-radius: 10px;
@@ -82,11 +83,6 @@
82 #actions .button-accept:hover {83 #actions .button-accept:hover {
83 background: #9c5;84 background: #9c5;
84 }85 }
85 iframe#eula {
86 width: 100%;
87 height: 100%;
88 scrolling: auto;
89 }
90</style>86</style>
91</head>87</head>
92<body>88<body>
9389
=== modified file 'licenses/ste.html'
--- licenses/ste.html 2012-04-20 16:00:26 +0000
+++ licenses/ste.html 2012-04-24 10:59:21 +0000
@@ -88,11 +88,6 @@
88 #actions .button-accept:hover {88 #actions .button-accept:hover {
89 background: #9c5;89 background: #9c5;
90 }90 }
91 iframe#eula {
92 width: 100%;
93 height: 100%;
94 scrolling: auto;
95 }
96</style>91</style>
97</head>92</head>
98<body>93<body>
9994
=== modified file 'testing/test_click_through_license.py'
--- testing/test_click_through_license.py 2012-03-27 09:53:11 +0000
+++ testing/test_click_through_license.py 2012-04-24 10:59:21 +0000
@@ -24,9 +24,14 @@
24linaro_license_path = '/licenses/linaro.html'24linaro_license_path = '/licenses/linaro.html'
25samsung_test_file = '/android/~linaro-android/staging-origen/test.txt'25samsung_test_file = '/android/~linaro-android/staging-origen/test.txt'
26ste_test_file = '/android/~linaro-android/staging-snowball/173/target/product/snowball/test.txt'26ste_test_file = '/android/~linaro-android/staging-snowball/173/target/product/snowball/test.txt'
27ste_open_test_file = '/android/~linaro-android/staging-snowball/173/test.txt'
27never_available = '/android/~linaro-android/staging-imx53/test.txt'28never_available = '/android/~linaro-android/staging-imx53/test.txt'
28linaro_test_file = '/android/~linaro-android/staging-panda/test.txt'29linaro_test_file = '/android/~linaro-android/staging-panda/test.txt'
29not_protected_test_file = '/android/~linaro-android/staging-vexpress-a9/test.txt'30not_protected_test_file = '/android/~linaro-android/staging-vexpress-a9/test.txt'
31per_file_samsung_test_file = '/android/images/origen-blob.txt'
32per_file_ste_test_file = '/android/images/snowball-blob.txt'
33per_file_not_protected_test_file = '/android/images/MANIFEST'
34dirs_only_dir = '/android/~linaro-android/'
3035
3136
32class Contains(object):37class Contains(object):
@@ -180,7 +185,7 @@
180 self.assertThat(testfile, Contains(search))185 self.assertThat(testfile, Contains(search))
181186
182 def test_accept_license_samsung_file(self):187 def test_accept_license_samsung_file(self):
183 search = "This is a protected with click-through Samsung license."188 search = "This is protected with click-through Samsung license."
184 testfile = fetcher.get(host + samsung_test_file)189 testfile = fetcher.get(host + samsung_test_file)
185 fetcher.close()190 fetcher.close()
186 if os.path.exists("%s/cookies.txt" % docroot):191 if os.path.exists("%s/cookies.txt" % docroot):
@@ -194,7 +199,7 @@
194 self.assertThat(testfile, Contains(search))199 self.assertThat(testfile, Contains(search))
195200
196 def test_accept_license_ste_file(self):201 def test_accept_license_ste_file(self):
197 search = "This is a protected with click-through ST-E license."202 search = "This is protected with click-through ST-E license."
198 testfile = fetcher.get(host + ste_test_file)203 testfile = fetcher.get(host + ste_test_file)
199 fetcher.close()204 fetcher.close()
200 if os.path.exists("%s/cookies.txt" % docroot):205 if os.path.exists("%s/cookies.txt" % docroot):
@@ -207,19 +212,19 @@
207 self.assertThat(testfile, Contains(search))212 self.assertThat(testfile, Contains(search))
208213
209 def test_license_accepted_samsung(self):214 def test_license_accepted_samsung(self):
210 search = "This is a protected with click-through Samsung license."215 search = "This is protected with click-through Samsung license."
211 os.rename("%s/cookies.samsung" % docroot, "%s/cookies.txt" % docroot)216 os.rename("%s/cookies.samsung" % docroot, "%s/cookies.txt" % docroot)
212 testfile = fetcher.get(host + samsung_test_file, ignore_license=True)217 testfile = fetcher.get(host + samsung_test_file, ignore_license=True)
213 self.assertThat(testfile, Contains(search))218 self.assertThat(testfile, Contains(search))
214219
215 def test_license_accepted_ste(self):220 def test_license_accepted_ste(self):
216 search = "This is a protected with click-through ST-E license."221 search = "This is protected with click-through ST-E license."
217 os.rename("%s/cookies.ste" % docroot, "%s/cookies.txt" % docroot)222 os.rename("%s/cookies.ste" % docroot, "%s/cookies.txt" % docroot)
218 testfile = fetcher.get(host + ste_test_file, ignore_license=True)223 testfile = fetcher.get(host + ste_test_file, ignore_license=True)
219 self.assertThat(testfile, Contains(search))224 self.assertThat(testfile, Contains(search))
220225
221 def test_internal_host_samsung(self):226 def test_internal_host_samsung(self):
222 search = "This is a protected with click-through Samsung license."227 search = "This is protected with click-through Samsung license."
223 subprocess.Popen(['sed', '-i', '/## Let internal hosts through '228 subprocess.Popen(['sed', '-i', '/## Let internal hosts through '
224 'always./ a %s' % local_rewrite, '%s/.htaccess' % docroot],229 'always./ a %s' % local_rewrite, '%s/.htaccess' % docroot],
225 stdout=open('/dev/null', 'w'), stderr=subprocess.STDOUT).wait()230 stdout=open('/dev/null', 'w'), stderr=subprocess.STDOUT).wait()
@@ -228,10 +233,54 @@
228 self.assertThat(testfile, Contains(search))233 self.assertThat(testfile, Contains(search))
229234
230 def test_internal_host_ste(self):235 def test_internal_host_ste(self):
231 search = "This is a protected with click-through ST-E license."236 search = "This is protected with click-through ST-E license."
232 subprocess.Popen(['sed', '-i', '/## Let internal hosts through '237 subprocess.Popen(['sed', '-i', '/## Let internal hosts through '
233 'always./ a %s' % local_rewrite, '%s/.htaccess' % docroot],238 'always./ a %s' % local_rewrite, '%s/.htaccess' % docroot],
234 stdout=open('/dev/null', 'w'), stderr=subprocess.STDOUT).wait()239 stdout=open('/dev/null', 'w'), stderr=subprocess.STDOUT).wait()
235 testfile = fetcher.get(host + ste_test_file, ignore_license=True)240 testfile = fetcher.get(host + ste_test_file, ignore_license=True)
236 shutil.copy("%s/dothtaccess" % docroot, "%s/.htaccess" % docroot)241 shutil.copy("%s/dothtaccess" % docroot, "%s/.htaccess" % docroot)
237 self.assertThat(testfile, Contains(search))242 self.assertThat(testfile, Contains(search))
243
244 def test_ste_open_file(self):
245 search = "This is always available."
246 testfile = fetcher.get(host + ste_open_test_file)
247 self.assertThat(testfile, Contains(search))
248
249 def test_per_file_accept_license_samsung_file(self):
250 search = "This is protected with click-through Samsung license."
251 testfile = fetcher.get(host + per_file_samsung_test_file)
252 fetcher.close()
253 if os.path.exists("%s/cookies.txt" % docroot):
254 os.rename("%s/cookies.txt" % docroot,
255 "%s/cookies.samsung" % docroot)
256 self.assertThat(testfile, Contains(search))
257
258 def test_per_file_accept_license_ste_file(self):
259 search = "This is protected with click-through ST-E license."
260 testfile = fetcher.get(host + per_file_ste_test_file)
261 fetcher.close()
262 if os.path.exists("%s/cookies.txt" % docroot):
263 os.rename("%s/cookies.txt" % docroot, "%s/cookies.ste" % docroot)
264 self.assertThat(testfile, Contains(search))
265
266 def test_per_file_license_accepted_samsung(self):
267 search = "This is protected with click-through Samsung license."
268 os.rename("%s/cookies.samsung" % docroot, "%s/cookies.txt" % docroot)
269 testfile = fetcher.get(host + per_file_samsung_test_file, ignore_license=True)
270 self.assertThat(testfile, Contains(search))
271
272 def test_per_file_license_accepted_ste(self):
273 search = "This is protected with click-through ST-E license."
274 os.rename("%s/cookies.ste" % docroot, "%s/cookies.txt" % docroot)
275 testfile = fetcher.get(host + per_file_ste_test_file, ignore_license=True)
276 self.assertThat(testfile, Contains(search))
277
278 def test_per_file_non_protected_dirs(self):
279 search = "MANIFEST"
280 testfile = fetcher.get(host + per_file_not_protected_test_file)
281 self.assertThat(testfile, Contains(search))
282
283 def test_dir_containing_only_dirs(self):
284 search = "Index of /android/~linaro-android"
285 testfile = fetcher.get(host + dirs_only_dir)
286 self.assertThat(testfile, Contains(search))

Subscribers

People subscribed via source and target branches