provide next_level as a nice-looking string
Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
This commit is contained in:
parent
fa56e51ce3
commit
04e09af8a9
|
@ -128,6 +128,10 @@ class Character(models.Model):
|
|||
"""Provide a string representation for display, etc. purposes."""
|
||||
return f"{self.name}, the level {self.level} {self.character_class}"
|
||||
|
||||
def next_level_str(self):
|
||||
"""Return a nicely-formatted version of next_level."""
|
||||
return self.next_level.strftime('%Y-%m-%d %H:%M:%S %Z')
|
||||
|
||||
def calculate_datetime_to_next_level(self):
|
||||
"""Determine when the next level will be reached (barring no penalties or logoffs).
|
||||
|
||||
|
|
|
@ -28,6 +28,11 @@ class CharacterTest(TestCase):
|
|||
logger.debug(str(char))
|
||||
assert str(char) == "bss, the level 0 tester"
|
||||
|
||||
def test_next_level_str(self):
|
||||
"""Test the format of the readable next level string."""
|
||||
char = Character.objects.get(pk=1)
|
||||
assert char.next_level_str() == "2024-05-05 05:20:45 UTC"
|
||||
|
||||
def test_log_out(self):
|
||||
"""Test basic log out functionality and end result."""
|
||||
char = Character.objects.get(pk=1)
|
||||
|
|
Loading…
Reference in New Issue