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
aa645280
Commit
aa645280
authored
3 years ago
by
Vikas
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for render_bundle templatetag
parent
250502ff
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hypha/apply/utils/tests/test_templatetags.py
+26
-0
26 additions, 0 deletions
hypha/apply/utils/tests/test_templatetags.py
with
26 additions
and
0 deletions
hypha/apply/utils/tests/test_templatetags.py
0 → 100644
+
26
−
0
View file @
aa645280
from
unittest
import
mock
from
django.test
import
SimpleTestCase
,
override_settings
from
hypha.apply.utils.templatetags.webpack_tags
import
render_bundle
class
WebpackTagsTestCase
(
SimpleTestCase
):
@override_settings
(
ENABLE_WEBPACK_BUNDLES
=
True
)
def
test_render_bundle_calls_webpack_loader_when_enabled
(
self
):
render_bundle_path
=
'
hypha.apply.utils.templatetags.webpack_tags.webpack_loader.render_bundle
'
with
mock
.
patch
(
render_bundle_path
,
return_value
=
'
foo.js
'
)
as
mocked_render_bundle
:
self
.
assertEqual
(
render_bundle
(
'
foo
'
,
'
js
'
),
'
foo.js
'
)
mocked_render_bundle
.
assert_called_once_with
(
'
foo
'
,
'
js
'
,
'
DEFAULT
'
,
''
)
@override_settings
(
ENABLE_WEBPACK_BUNDLES
=
False
)
def
test_render_bundle_does_not_call_webpack_loader_when_disabled
(
self
):
render_bundle_path
=
'
hypha.apply.utils.templatetags.webpack_tags.webpack_loader.render_bundle
'
with
mock
.
patch
(
render_bundle_path
,
return_value
=
'
foo.js
'
)
as
mocked_render_bundle
:
self
.
assertEqual
(
render_bundle
(
'
foo
'
,
'
js
'
),
''
)
self
.
assertFalse
(
mocked_render_bundle
.
called
)
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