Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ots
hypha
Commits
3f0a238d
Commit
3f0a238d
authored
6 years ago
by
Todd Dembrey
Browse files
Options
Downloads
Patches
Plain Diff
Fix the test that was not returning an absolute URL
parent
39c729be
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
opentech/apply/funds/tests/test_views.py
+2
-1
2 additions, 1 deletion
opentech/apply/funds/tests/test_views.py
opentech/apply/utils/testing/tests.py
+6
-9
6 additions, 9 deletions
opentech/apply/utils/testing/tests.py
with
8 additions
and
10 deletions
opentech/apply/funds/tests/test_views.py
+
2
−
1
View file @
3f0a238d
...
...
@@ -223,7 +223,8 @@ class TestStaffSealedView(BaseSubmissionViewTestCase):
def
test_cant_post_to_sealed
(
self
):
submission
=
SealedSubmissionFactory
()
response
=
self
.
post_page
(
submission
,
{
'
some
'
:
'
data
'
},
'
sealed
'
)
url
=
self
.
url_from_pattern
(
'
funds:submissions:sealed
'
,
kwargs
=
{
'
pk
'
:
submission
.
id
})
# Because of the redirect chain the url returned is not absolute
url
=
self
.
url_from_pattern
(
'
funds:submissions:sealed
'
,
kwargs
=
{
'
pk
'
:
submission
.
id
},
absolute
=
False
)
self
.
assertRedirects
(
response
,
url
)
def
test_non_sealed_unaffected
(
self
):
...
...
This diff is collapsed.
Click to expand it.
opentech/apply/utils/testing/tests.py
+
6
−
9
View file @
3f0a238d
...
...
@@ -32,17 +32,14 @@ class BaseViewTestCase(TestCase):
def
url
(
self
,
instance
,
view_name
=
None
,
absolute
=
True
):
full_url_name
=
self
.
url_name
.
format
(
view_name
or
self
.
base_view_name
)
url
=
reverse
(
full_url_name
,
kwargs
=
self
.
get_kwargs
(
instance
))
if
not
absolute
:
return
url
return
self
.
url_from_pattern
(
full_url_name
,
self
.
get_kwargs
(
instance
),
secure
=
True
,
absolute
=
absolute
)
request
=
self
.
factory
.
get
(
url
,
secure
=
True
)
return
request
.
build_absolute_uri
()
def
url_from_pattern
(
self
,
pattern
,
kwargs
=
None
):
def
url_from_pattern
(
self
,
pattern
,
kwargs
=
None
,
secure
=
True
,
absolute
=
True
):
url
=
reverse
(
pattern
,
kwargs
=
kwargs
)
request
=
self
.
factory
.
get
(
url
,
secure
=
True
)
return
request
.
build_absolute_uri
()
request
=
self
.
factory
.
get
(
url
,
secure
=
secure
)
if
absolute
:
return
request
.
build_absolute_uri
()
return
request
.
path
def
get_page
(
self
,
instance
=
None
,
view_name
=
None
):
return
self
.
client
.
get
(
self
.
url
(
instance
,
view_name
),
secure
=
True
,
follow
=
True
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment