Commit 181559a4 authored by Weblate's avatar Weblate

Merge remote-tracking branch 'origin/master'

parents f8412acc b5c03b31
......@@ -309,18 +309,6 @@ class BasicViewTest(ViewTestCase):
)
self.assertContains(response, 'Test/Test')
def test_review_source(self):
response = self.client.get(
reverse('review_source', kwargs=self.kw_subproject)
)
self.assertContains(response, 'Test/Test')
def test_view_source(self):
response = self.client.get(
reverse('show_source', kwargs=self.kw_subproject)
)
self.assertContains(response, 'Test/Test')
def test_view_unit(self):
unit = self.get_unit()
response = self.client.get(
......@@ -880,3 +868,41 @@ class HomeViewTest(ViewTestCase):
appsettings.ENABLE_WHITEBOARD = False
response = self.client.get(reverse('home'))
self.assertNotContains(response, 'whiteboard')
class SourceStringsTest(ViewTestCase):
def test_edit_priority(self):
# Need extra power
self.user.is_superuser = True
self.user.save()
source = self.get_unit().source_info
response = self.client.post(
reverse('edit_priority', kwargs={'pk': source.pk}),
{'priority': 60}
)
self.assertRedirects(response, source.get_absolute_url())
unit = self.get_unit()
self.assertEquals(unit.priority, 60)
self.assertEquals(unit.source_info.priority, 60)
def test_review_source(self):
response = self.client.get(
reverse('review_source', kwargs=self.kw_subproject)
)
self.assertContains(response, 'Test/Test')
def test_review_source_expand(self):
unit = self.get_unit()
response = self.client.get(
reverse('review_source', kwargs=self.kw_subproject),
{'checksum': unit.checksum}
)
self.assertContains(response, unit.checksum)
def test_view_source(self):
response = self.client.get(
reverse('show_source', kwargs=self.kw_subproject)
)
self.assertContains(response, 'Test/Test')
......@@ -31,19 +31,24 @@ from weblate.trans.models import Translation, Source
from weblate.trans.forms import PriorityForm
def review_source(request, project, subproject):
def get_source(request, project, subproject):
"""
Listing of source strings to review.
Returns first translation in subproject
(this assumes all have same source strings).
"""
obj = get_subproject(request, project, subproject)
# Grab first translation in subproject
# (this assumes all have same source strings)
try:
source = obj.translation_set.all()[0]
return obj, obj.translation_set.all()[0]
except Translation.DoesNotExist:
raise Http404('No translation exists in this component.')
def review_source(request, project, subproject):
"""
Listing of source strings to review.
"""
obj, source = get_source(request, project, subproject)
# Grab search type and page number
rqtype = request.GET.get('type', 'all')
limit = request.GET.get('limit', 50)
......@@ -89,14 +94,7 @@ def show_source(request, project, subproject):
"""
Show source strings summary and checks.
"""
obj = get_subproject(request, project, subproject)
# Grab first translation in subproject
# (this assumes all have same source strings)
try:
source = obj.translation_set.all()[0]
except Translation.DoesNotExist:
raise Http404('No translation exists in this component.')
obj, source = get_source(request, project, subproject)
return render(
request,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment