Order templates by newest created first

When you add a new template, it’s probably the one that you want to do
subsequent stuff with. But it’s also helpful to see the template in
context (with its siblings) to understand that there are multiple
templates. So we don’t want to do what we do in
https://github.com/alphagov/notifications-admin/pull/648
for adding a new template.

But we _can_ make your brand-new template appear first by always
ordering by when the template was created.

This also removes the confusion caused by having `updated_at` affecting
order, and causing the templates to move around all the time.
This commit is contained in:
Chris Hill-Scott
2016-06-06 10:32:24 +01:00
parent eae0c252a0
commit c2ae4773da
3 changed files with 8 additions and 7 deletions

View File

@@ -250,10 +250,10 @@ def test_should_be_able_to_get_all_templates_for_a_service(notify_api, sample_us
assert response.status_code == 200
update_json_resp = json.loads(response.get_data(as_text=True))
assert update_json_resp['data'][0]['name'] == 'my template 1'
assert update_json_resp['data'][0]['name'] == 'my template 2'
assert update_json_resp['data'][0]['version'] == 1
assert update_json_resp['data'][0]['created_at']
assert update_json_resp['data'][1]['name'] == 'my template 2'
assert update_json_resp['data'][1]['name'] == 'my template 1'
assert update_json_resp['data'][1]['version'] == 1
assert update_json_resp['data'][1]['created_at']