[Patchew-devel] [PATCH 2/9] test_message: just use a single from
Paolo Bonzini
pbonzini at redhat.com
Thu Jan 16 15:09:02 UTC 2020
Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
---
tests/test_message.py | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/tests/test_message.py b/tests/test_message.py
index 69dcde8..bc0a98d 100755
--- a/tests/test_message.py
+++ b/tests/test_message.py
@@ -8,27 +8,26 @@
# This work is licensed under the MIT License. Please see the LICENSE file or
# http://opensource.org/licenses/MIT.
+import json
import time
import datetime
from .patchewtest import PatchewTestCase, main
+from api.models import Message
-class ProjectTest(PatchewTestCase):
+
+class MessageTest(PatchewTestCase):
def setUp(self):
self.create_superuser()
def test_0_second(self):
- from api.models import Message
-
message = Message()
message.date = datetime.datetime.utcnow()
age = message.get_age()
self.assertEqual(age, "0 second")
def test_now(self):
- from api.models import Message
-
message = Message()
dt = datetime.datetime.fromtimestamp(time.time() + 100)
message.date = dt
@@ -36,8 +35,6 @@ class ProjectTest(PatchewTestCase):
self.assertEqual(age, "now")
def test_1_day(self):
- from api.models import Message
-
message = Message()
dt = datetime.datetime.fromtimestamp(time.time() - 3600 * 25)
message.date = dt
@@ -45,8 +42,6 @@ class ProjectTest(PatchewTestCase):
self.assertEqual(age, "1 day")
def test_asctime(self):
- from api.models import Message
-
message = Message()
dt = datetime.datetime(2016, 10, 22, 10, 16, 40)
message.date = dt
--
2.21.0
More information about the Patchew-devel
mailing list