def test_setters_none(self): doc = AgentProfileDocument() doc.id = None doc.content_type = None doc.content = None doc.etag = None doc.timestamp = None doc.agent = 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)
def test_setters(self): doc = AgentProfileDocument() 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 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)
def test_agent_setter(self): doc = AgentProfileDocument() doc.agent = {"mbox": "mailto:[email protected]"} self.assertIsInstance(doc.agent, Agent) self.assertEqual(doc.agent.mbox, self.agent.mbox)