Merge lp:~ltrager/maas/lp1598461_2.0 into lp:maas/2.0

Proposed by Lee Trager
Status: Merged
Approved by: Lee Trager
Approved revision: no longer in the source branch.
Merged at revision: 5149
Proposed branch: lp:~ltrager/maas/lp1598461_2.0
Merge into: lp:maas/2.0
Diff against target: 75 lines (+36/-4)
2 files modified
src/maas/settings.py (+3/-3)
src/maasserver/views/tests/test_images.py (+33/-1)
To merge this branch: bzr merge lp:~ltrager/maas/lp1598461_2.0
Reviewer Review Type Date Requested Status
Lee Trager (community) Approve
Review via email: mp+299594@code.launchpad.net

Commit message

Show image last update using the time format consistent with other areas of the MAAS UI

To post a comment you must log in.
Revision history for this message
Lee Trager (ltrager) wrote :

Merge has no changes, approved in other MP

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/maas/settings.py'
--- src/maas/settings.py 2016-06-07 19:59:49 +0000
+++ src/maas/settings.py 2016-07-08 18:17:11 +0000
@@ -156,9 +156,9 @@
156# to load the internationalization machinery.156# to load the internationalization machinery.
157USE_I18N = True157USE_I18N = True
158158
159# If you set this to False, Django will not format dates, numbers and159# Set the datetime format Django uses in templates to show the time in UTC.
160# calendars according to the current locale160# The format is consistent with what the websockets use.
161USE_L10N = True161DATETIME_FORMAT = 'D, d M. o H:i:s'
162162
163# Absolute filesystem path to the directory that will hold user-uploaded files.163# Absolute filesystem path to the directory that will hold user-uploaded files.
164# Example: "/home/media/media.lawrence.com/media/"164# Example: "/home/media/media.lawrence.com/media/"
165165
=== modified file 'src/maasserver/views/tests/test_images.py'
--- src/maasserver/views/tests/test_images.py 2016-06-10 17:54:17 +0000
+++ src/maasserver/views/tests/test_images.py 2016-07-08 18:17:11 +0000
@@ -308,7 +308,11 @@
308 last_update = doc.cssselect(308 last_update = doc.cssselect(
309 'table#other-resources > tbody > '309 'table#other-resources > tbody > '
310 'tr > td')[5].text_content().strip()310 'tr > td')[5].text_content().strip()
311 self.assertNotEqual('not synced', last_update)311 dt = datetime.datetime.strptime(last_update, '%a, %d %b. %Y %H:%M:%S')
312 # TimestampedModel includes microseconds which we don't print. To
313 # confirm the right time is returned its easiest to just compare the
314 # ctimes
315 self.assertEquals(cache.updated.ctime(), dt.ctime())
312316
313 def test_shows_number_of_nodes_for_synced_resource(self):317 def test_shows_number_of_nodes_for_synced_resource(self):
314 self.client_log_in(as_admin=True)318 self.client_log_in(as_admin=True)
@@ -480,6 +484,20 @@
480 1, len(delete_btn),484 1, len(delete_btn),
481 "Didn't show delete button for generated image.")485 "Didn't show delete button for generated image.")
482486
487 def test_shows_last_update_time_for_synced_resource(self):
488 self.client_log_in(as_admin=True)
489 resource = self.make_generated_resource()
490 response = self.client.get(reverse('images'))
491 doc = fromstring(response.content)
492 last_update = doc.cssselect(
493 'table#generated-resources > tbody > '
494 'tr > td')[5].text_content().strip()
495 dt = datetime.datetime.strptime(last_update, '%a, %d %b. %Y %H:%M:%S')
496 # TimestampedModel includes microseconds which we don't print. To
497 # confirm the right time is returned its easiest to just compare the
498 # ctimes
499 self.assertEquals(resource.updated.ctime(), dt.ctime())
500
483 def test_hides_delete_button_for_generated_resource_when_not_admin(self):501 def test_hides_delete_button_for_generated_resource_when_not_admin(self):
484 self.client_log_in()502 self.client_log_in()
485 self.make_generated_resource()503 self.make_generated_resource()
@@ -552,6 +570,20 @@
552 'table#uploaded-resources > tbody > tr > td')[1].text_content()570 'table#uploaded-resources > tbody > tr > td')[1].text_content()
553 self.assertEqual(name, name_col.strip())571 self.assertEqual(name, name_col.strip())
554572
573 def test_shows_last_update_time_for_synced_resource(self):
574 self.client_log_in(as_admin=True)
575 resource = self.make_uploaded_resource()
576 response = self.client.get(reverse('images'))
577 doc = fromstring(response.content)
578 last_update = doc.cssselect(
579 'table#uploaded-resources > tbody > '
580 'tr > td')[5].text_content().strip()
581 dt = datetime.datetime.strptime(last_update, '%a, %d %b. %Y %H:%M:%S')
582 # TimestampedModel includes microseconds which we don't print. To
583 # confirm the right time is returned its easiest to just compare the
584 # ctimes
585 self.assertEquals(resource.updated.ctime(), dt.ctime())
586
555 def test_shows_delete_button_for_uploaded_resource(self):587 def test_shows_delete_button_for_uploaded_resource(self):
556 self.client_log_in(as_admin=True)588 self.client_log_in(as_admin=True)
557 self.make_uploaded_resource()589 self.make_uploaded_resource()

Subscribers

People subscribed via source and target branches

to all changes: