Beispiel #1
0
 def test_setters_none(self):
     doc = StateDocument()
     doc.id = None
     doc.content_type = None
     doc.content = None
     doc.etag = None
     doc.timestamp = None
     doc.agent = None
     doc.activity = None
     doc.registration = None
     self.assertIsNone(doc.id)
     self.assertIsNone(doc.content_type)
     self.assertIsNone(doc.content)
     self.assertIsNone(doc.etag)
     self.assertIsNone(doc.timestamp)
     self.assertIsNone(doc.agent)
     self.assertIsNone(doc.activity)
     self.assertIsNone(doc.registration)
    def test_setters_none(self):
        doc = StateDocument()
        doc.id = None
        doc.content_type = None
        doc.content = None
        doc.etag = None
        doc.timestamp = None
        doc.agent = None
        doc.activity = None
        doc.registration = None

        self.assertIsNone(doc.id)
        self.assertIsNone(doc.content_type)
        self.assertIsNone(doc.content)
        self.assertIsNone(doc.etag)
        self.assertIsNone(doc.timestamp)
        self.assertIsNone(doc.agent)
        self.assertIsNone(doc.activity)
        self.assertIsNone(doc.registration)
Beispiel #3
0
 def test_setters(self):
     doc = StateDocument()
     doc.id = "test"
     doc.content_type = "test type"
     doc.content = bytearray("test bytearray", "utf-8")
     doc.etag = "test etag"
     doc.timestamp = "2014-06-23T15:25:00-05:00"
     doc.agent = self.agent
     doc.activity = self.activity
     doc.registration = "test registration"
     self.assertEqual(doc.id, "test")
     self.assertEqual(doc.content_type, "test type")
     self.assertEqual(doc.content, bytearray("test bytearray", "utf-8"))
     self.assertEqual(doc.etag, "test etag")
     central = pytz.timezone("US/Central")  # UTC -0500
     dt = central.localize(datetime(2014, 6, 23, 15, 25))
     self.assertEqual(doc.timestamp, dt)
     self.assertEqual(doc.agent, self.agent)
     self.assertEqual(doc.activity, self.activity)
     self.assertEqual(doc.registration, "test registration")
    def test_setters(self):
        doc = StateDocument()
        doc.id = "test"
        doc.content_type = "test type"
        doc.content = bytearray("test bytearray", "utf-8")
        doc.etag = "test etag"
        doc.timestamp = "2014-06-23T15:25:00-05:00"
        doc.agent = self.agent
        doc.activity = self.activity
        doc.registration = "test registration"

        self.assertEqual(doc.id, "test")
        self.assertEqual(doc.content_type, "test type")
        self.assertEqual(doc.content, bytearray("test bytearray", "utf-8"))
        self.assertEqual(doc.etag, "test etag")

        central = pytz.timezone("US/Central")   # UTC -0500
        dt = central.localize(datetime(2014, 6, 23, 15, 25))
        self.assertEqual(doc.timestamp, dt)
        self.assertEqual(doc.agent, self.agent)
        self.assertEqual(doc.activity, self.activity)
        self.assertEqual(doc.registration, "test registration")