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
1=== modified file 'ubuntuone/web/tests/sst/files/u1webf002_publishfile.py'
2--- ubuntuone/web/tests/sst/files/u1webf002_publishfile.py 2011-11-07 17:12:35 +0000
3+++ ubuntuone/web/tests/sst/files/u1webf002_publishfile.py 2011-11-17 22:08:29 +0000
4@@ -28,7 +28,6 @@
5 import os.path
6 import tempfile
7 import uuid
8-import urlparse
9
10 setup_actions.setup()
11 files_actions.open()
12@@ -45,8 +44,5 @@
13 file_name = os.path.basename(upload.name)
14 files_actions.publish_file(file_name)
15 files_actions.assert_file_published(file_name)
16-file_url = files_actions.get_public_url(file_name)
17-parsed_url = urlparse.urlparse(file_url)
18-set_base_url(file_url[:-len(parsed_url.path)])
19-goto(parsed_url.path)
20+file_url = files_actions.go_to_public_url(file_name)
21 text_is(get_element(tag='body'), file_contents)
22
23=== modified file 'ubuntuone/web/tests/sst/files/u1webf003_stoppublishingfile.py'
24--- ubuntuone/web/tests/sst/files/u1webf003_stoppublishingfile.py 2011-11-04 23:02:16 +0000
25+++ ubuntuone/web/tests/sst/files/u1webf003_stoppublishingfile.py 2011-11-17 22:08:29 +0000
26@@ -28,7 +28,6 @@
27 import os.path
28 import tempfile
29 import uuid
30-import urlparse
31
32 setup_actions.setup()
33 files_actions.open()
34@@ -45,10 +44,9 @@
35 file_name = os.path.basename(upload.name)
36 files_actions.publish_file(file_name)
37 files_actions.assert_file_published(file_name)
38-file_url = files_actions.get_public_url(file_name)
39+base_url, path = files_actions.get_public_url(file_name)
40 files_actions.stop_publishing_file(file_name)
41 files_actions.assert_file_not_published(file_name)
42-parsed_url = urlparse.urlparse(file_url)
43-set_base_url(file_url.rstrip(parsed_url.path))
44-goto(parsed_url.path)
45+set_base_url(base_url)
46+goto(path)
47 text_is(get_element(tag='body'), 'Could not locate object')
48
49=== modified file 'ubuntuone/web/tests/sst/shared/actions/files.py'
50--- ubuntuone/web/tests/sst/shared/actions/files.py 2011-11-15 19:12:12 +0000
51+++ ubuntuone/web/tests/sst/shared/actions/files.py 2011-11-17 22:08:29 +0000
52@@ -23,6 +23,7 @@
53 from sst.actions import _get_elem
54 from config import DEFAULT_TIMEOUT
55 from loading import *
56+import urlparse
57
58 def open():
59 """Open the files page and assert it's title."""
60@@ -248,7 +249,16 @@
61 input_public_url = get_element_by_xpath('id("%s-details")//'
62 'input[@class="public_url"]'
63 % _get_file_identifier(name))
64- return input_public_url.get_attribute('value')
65+ public_url = input_public_url.get_attribute('value')
66+ parsed_url = urlparse.urlparse(public_url)
67+ base_url = public_url[:-len(parsed_url.path)]
68+ path = parsed_url.path
69+ return base_url, path
70+
71+def go_to_public_url(name):
72+ base_url, path = get_public_url(name)
73+ set_base_url(base_url)
74+ goto(path)
75
76 def stop_publishing_file(name):
77 """Stop publishing a file.

Subscribers

People subscribed via source and target branches