aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStevan Radakovic <stevan.radakovic@linaro.org>2012-05-11 10:32:52 +0200
committerStevan Radakovic <stevan.radakovic@linaro.org>2012-05-11 10:32:52 +0200
commit77c14230b6835ff48e02cfb574bb84ab83ed5b43 (patch)
tree38a8a6456cfc1bbc3189f545c423300582d119d1
parent37ad9876289b6d8b6ceeea4519c48277b725d052 (diff)
Tests updated to use new filefetcher
-rw-r--r--testing/license_protected_file_downloader.py11
-rw-r--r--testing/test_click_through_license.py22
2 files changed, 18 insertions, 15 deletions
diff --git a/testing/license_protected_file_downloader.py b/testing/license_protected_file_downloader.py
index c0c9e81..2a3bfff 100644
--- a/testing/license_protected_file_downloader.py
+++ b/testing/license_protected_file_downloader.py
@@ -182,12 +182,15 @@ class LicenseProtectedFileFetcher:
file = os.path.split(file)[-1]
# Look for a link with accepted.html in the page name. Follow it.
+ accept_search, decline_search = None, None
for line in self.body.splitlines():
- accept_search = re.search(
- r"""href=.*?["'](.*?-accepted.html)""",
+ if not accept_search:
+ accept_search = re.search(
+ """href=.*?["'](.*?-accepted.html)""",
line)
- decline_search = re.search(
- r"""href=.*?["'](.*?-declined.html)""",
+ if not decline_search:
+ decline_search = re.search(
+ """href=.*?["'](.*?-declined.html)""",
line)
if accept_search and decline_search:
diff --git a/testing/test_click_through_license.py b/testing/test_click_through_license.py
index b8e1b3c..3288f85 100644
--- a/testing/test_click_through_license.py
+++ b/testing/test_click_through_license.py
@@ -145,19 +145,19 @@ class TestLicense(TestCase):
self.assertThat(testfile, Contains(search))
def test_redirect_to_license_samsung(self):
- search = "LICENSE AGREEMENT"
- testfile = fetcher.get(host + samsung_test_file, ignore_license=True)
- self.assertThat(testfile, Contains(search))
+ search = "PLEASE READ THE FOLLOWING AGREEMENT CAREFULLY"
+ testfile = fetcher.get_or_return_license(host + samsung_test_file)
+ self.assertThat(testfile[0], Contains(search))
def test_redirect_to_license_ste(self):
- search = "LICENSE AGREEMENT"
- testfile = fetcher.get(host + ste_test_file, ignore_license=True)
- self.assertThat(testfile, Contains(search))
+ search = "PLEASE READ THE FOLLOWING AGREEMENT CAREFULLY"
+ testfile = fetcher.get_or_return_license(host + ste_test_file)
+ self.assertThat(testfile[0], Contains(search))
def test_redirect_to_license_linaro(self):
- search = "LICENSE AGREEMENT"
- testfile = fetcher.get(host + linaro_test_file, ignore_license=True)
- self.assertThat(testfile, Contains(search))
+ search = "Linaro license."
+ testfile = fetcher.get_or_return_license(host + linaro_test_file)
+ self.assertThat(testfile[0], Contains(search))
def test_decline_license_samsung(self):
search = "License has not been accepted"
@@ -214,13 +214,13 @@ class TestLicense(TestCase):
def test_license_accepted_samsung(self):
search = "This is protected with click-through Samsung license."
os.rename("%s/cookies.samsung" % docroot, "%s/cookies.txt" % docroot)
- testfile = fetcher.get(host + samsung_test_file, ignore_license=True)
+ testfile = fetcher.get(host + samsung_test_file)
self.assertThat(testfile, Contains(search))
def test_license_accepted_ste(self):
search = "This is protected with click-through ST-E license."
os.rename("%s/cookies.ste" % docroot, "%s/cookies.txt" % docroot)
- testfile = fetcher.get(host + ste_test_file, ignore_license=True)
+ testfile = fetcher.get(host + ste_test_file)
self.assertThat(testfile, Contains(search))
def test_internal_host_samsung(self):