Commit 80596896 authored by Miquel Torres's avatar Miquel Torres
Browse files

Fix remaining Django 1.10 deprecations.

- Don't use RequestContext
- Don't use dotted url path
parent 7ca36b84
......@@ -14,7 +14,7 @@ from codespeed.models import (Project, Benchmark, Revision, Branch, Executable,
class TestAddResult(TestCase):
def setUp(self):
self.path = reverse('codespeed.views.add_result')
self.path = reverse('add-result')
self.e = Environment.objects.create(name='Dual Core',
cpu='Core 2 Duo 8200')
temp = datetime.today()
......@@ -167,12 +167,13 @@ class TestAddResult(TestCase):
class TestAddJSONResults(TestCase):
def setUp(self):
self.path = reverse('codespeed.views.add_json_results')
self.path = reverse('add-json-results')
self.e = Environment(name='bigdog', cpu='Core 2 Duo 8200')
self.e.save()
temp = datetime.today()
self.cdate = datetime(
temp.year, temp.month, temp.day, temp.hour, temp.minute, temp.second)
temp.year, temp.month, temp.day, temp.hour, temp.minute,
temp.second)
self.data = [
{'commitid': '123',
......@@ -335,7 +336,7 @@ class TestTimeline(TestCase):
def test_gettimelinedata(self):
"""Test that gettimelinedata returns correct timeline data
"""
path = reverse('codespeed.views.gettimelinedata')
path = reverse('gettimelinedata')
data = {
"exe": "1,2",
"base": "2+4",
......@@ -382,16 +383,16 @@ class TestReports(TestCase):
'environment': 'Dual Core',
'result_value': 200,
}
resp = self.client.post(reverse('codespeed.views.add_result'),
resp = self.client.post(reverse('add-result'),
self.data)
self.assertEqual(resp.status_code, 202)
self.data['commitid'] = "abcd2"
self.data['result_value'] = 150
self.client.post(reverse('codespeed.views.add_result'), self.data)
self.client.post(reverse('add-result'), self.data)
self.assertEqual(resp.status_code, 202)
def test_reports(self):
response = self.client.get(reverse('codespeed.views.reports'))
response = self.client.get(reverse('reports'))
self.assertEqual(response.status_code, 200)
content = response.content.decode()
......@@ -400,7 +401,7 @@ class TestReports(TestCase):
self.assertIn(self.data['commitid'], content)
def test_reports_post_returns_405(self):
response = self.client.post(reverse('codespeed.views.reports'), {})
response = self.client.post(reverse('reports'), {})
self.assertEqual(response.status_code, 405)
......
......@@ -29,6 +29,6 @@ urlpatterns += [
urlpatterns += [
# URLs for adding results
url(r'^result/add/json/$', views.add_json_results),
url(r'^result/add/$', views.add_result),
url(r'^result/add/json/$', views.add_json_results, name='add-json-results'),
url(r'^result/add/$', views.add_result, name='add-result'),
]
......@@ -702,8 +702,7 @@ def reports(request):
colorcode__in=('red', 'green')
).order_by('-revision__date')[:10]
return render_to_response('codespeed/reports.html', context,
context_instance=RequestContext(request))
return render_to_response('codespeed/reports.html', context)
@require_GET
......
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