Exemplo n.º 1
0
    def test_timestamp_from_future(self):
        """Message from the future"""

        now = datetime.datetime.utcnow()
        timestamp = dt_to_ts(now + (self.mtd * 2) + one_second)
        with self.assertRaises(exceptions.MessageFromFutureError):
            message.verify_time(timestamp)
Exemplo n.º 2
0
    def test_ancient_timestamp(self):
        """Message too old"""

        now = datetime.datetime.utcnow()
        timestamp = dt_to_ts(now - (self.mtd * 2) - self.mmtt -
                             (self.mat * 2) - one_second)
        with self.assertRaises(exceptions.MessageTooOldError):
            message.verify_time(timestamp)
Exemplo n.º 3
0
    def test_timestamp_within_range_middle(self):
        """Proper timestamp inside"""

        now = datetime.datetime.utcnow()
        timestamp = dt_to_ts(now)
        message.verify_time(timestamp)
Exemplo n.º 4
0
    def test_timestamp_within_range_high(self):
        """Proper timestamp high border"""

        now = datetime.datetime.utcnow()
        timestamp = dt_to_ts(now + (self.mtd * 2))
        message.verify_time(timestamp)
Exemplo n.º 5
0
    def test_timestamp_within_range_low(self):
        """Proper timestamp low border"""

        now = datetime.datetime.utcnow()
        timestamp = dt_to_ts(now - (self.mtd * 2) - self.mmtt - (self.mat * 2))
        message.verify_time(timestamp)