Merge lp:~elopio/ubuntuone-testing/fix-public-url into lp:ubuntuone-testing

Proposed by Leo Arias
Status: Merged
Approved by: Rick McBride
Approved revision: 57
Merged at revision: 57
Proposed branch: lp:~elopio/ubuntuone-testing/fix-public-url
Merge into: lp:ubuntuone-testing
Diff against target: 77 lines (+15/-11)
3 files modified
ubuntuone/web/tests/sst/files/u1webf002_publishfile.py (+1/-5)
ubuntuone/web/tests/sst/files/u1webf003_stoppublishingfile.py (+3/-5)
ubuntuone/web/tests/sst/shared/actions/files.py (+11/-1)
To merge this branch: bzr merge lp:~elopio/ubuntuone-testing/fix-public-url
Reviewer Review Type Date Requested Status
Rick McBride (community) Approve
Review via email: mp+82604@code.launchpad.net

Commit message

Fixes the public url bug in u1webf003, and a little refactoring.

Description of the change

For u1webf003, fixed the same url public bug that was present on u1webf002.
A little refactoring to return the two parts of the URL, and to add a funciton that navigates to the file.

To post a comment you must log in.
Revision history for this message
Rick McBride (rmcbride) wrote :

Cool!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubuntuone/web/tests/sst/files/u1webf002_publishfile.py'
--- ubuntuone/web/tests/sst/files/u1webf002_publishfile.py 2011-11-07 17:12:35 +0000
+++ ubuntuone/web/tests/sst/files/u1webf002_publishfile.py 2011-11-17 22:08:29 +0000
@@ -28,7 +28,6 @@
28import os.path28import os.path
29import tempfile29import tempfile
30import uuid30import uuid
31import urlparse
3231
33setup_actions.setup()32setup_actions.setup()
34files_actions.open()33files_actions.open()
@@ -45,8 +44,5 @@
45 file_name = os.path.basename(upload.name)44 file_name = os.path.basename(upload.name)
46files_actions.publish_file(file_name)45files_actions.publish_file(file_name)
47files_actions.assert_file_published(file_name)46files_actions.assert_file_published(file_name)
48file_url = files_actions.get_public_url(file_name)47file_url = files_actions.go_to_public_url(file_name)
49parsed_url = urlparse.urlparse(file_url)
50set_base_url(file_url[:-len(parsed_url.path)])
51goto(parsed_url.path)
52text_is(get_element(tag='body'), file_contents)48text_is(get_element(tag='body'), file_contents)
5349
=== modified file 'ubuntuone/web/tests/sst/files/u1webf003_stoppublishingfile.py'
--- ubuntuone/web/tests/sst/files/u1webf003_stoppublishingfile.py 2011-11-04 23:02:16 +0000
+++ ubuntuone/web/tests/sst/files/u1webf003_stoppublishingfile.py 2011-11-17 22:08:29 +0000
@@ -28,7 +28,6 @@
28import os.path28import os.path
29import tempfile29import tempfile
30import uuid30import uuid
31import urlparse
3231
33setup_actions.setup()32setup_actions.setup()
34files_actions.open()33files_actions.open()
@@ -45,10 +44,9 @@
45 file_name = os.path.basename(upload.name)44 file_name = os.path.basename(upload.name)
46files_actions.publish_file(file_name)45files_actions.publish_file(file_name)
47files_actions.assert_file_published(file_name)46files_actions.assert_file_published(file_name)
48file_url = files_actions.get_public_url(file_name)47base_url, path = files_actions.get_public_url(file_name)
49files_actions.stop_publishing_file(file_name)48files_actions.stop_publishing_file(file_name)
50files_actions.assert_file_not_published(file_name)49files_actions.assert_file_not_published(file_name)
51parsed_url = urlparse.urlparse(file_url)50set_base_url(base_url)
52set_base_url(file_url.rstrip(parsed_url.path))51goto(path)
53goto(parsed_url.path)
54text_is(get_element(tag='body'), 'Could not locate object')52text_is(get_element(tag='body'), 'Could not locate object')
5553
=== modified file 'ubuntuone/web/tests/sst/shared/actions/files.py'
--- ubuntuone/web/tests/sst/shared/actions/files.py 2011-11-15 19:12:12 +0000
+++ ubuntuone/web/tests/sst/shared/actions/files.py 2011-11-17 22:08:29 +0000
@@ -23,6 +23,7 @@
23from sst.actions import _get_elem23from sst.actions import _get_elem
24from config import DEFAULT_TIMEOUT24from config import DEFAULT_TIMEOUT
25from loading import *25from loading import *
26import urlparse
2627
27def open():28def open():
28 """Open the files page and assert it's title."""29 """Open the files page and assert it's title."""
@@ -248,7 +249,16 @@
248 input_public_url = get_element_by_xpath('id("%s-details")//'249 input_public_url = get_element_by_xpath('id("%s-details")//'
249 'input[@class="public_url"]'250 'input[@class="public_url"]'
250 % _get_file_identifier(name))251 % _get_file_identifier(name))
251 return input_public_url.get_attribute('value')252 public_url = input_public_url.get_attribute('value')
253 parsed_url = urlparse.urlparse(public_url)
254 base_url = public_url[:-len(parsed_url.path)]
255 path = parsed_url.path
256 return base_url, path
257
258def go_to_public_url(name):
259 base_url, path = get_public_url(name)
260 set_base_url(base_url)
261 goto(path)
252262
253def stop_publishing_file(name):263def stop_publishing_file(name):
254 """Stop publishing a file.264 """Stop publishing a file.

Subscribers

People subscribed via source and target branches