Пример #1
0
    def test_timestamps_are_returned_as_objects(self):
        model = Model()
        model.set_raw_attributes({
            'created_at': '2015-03-24',
            'updated_at': '2015-03-24'
        })

        self.assertIsInstance(model.created_at, Arrow)
        self.assertIsInstance(model.updated_at, Arrow)
Пример #2
0
    def test_timestamps_are_returned_as_objects_from_timestamps_and_datetime(
            self):
        model = Model()
        model.set_raw_attributes({
            'created_at': datetime.datetime.utcnow(),
            'updated_at': time.time()
        })

        self.assertIsInstance(model.created_at, Arrow)
        self.assertIsInstance(model.updated_at, Arrow)
Пример #3
0
    def test_to_dict_includes_default_formatted_timestamps(self):
        model = Model()
        model.set_raw_attributes({
            'created_at': '2015-03-24',
            'updated_at': '2015-03-25'
        })

        d = model.to_dict()

        self.assertEqual('2015-03-24T00:00:00+00:00', d['created_at'])
        self.assertEqual('2015-03-25T00:00:00+00:00', d['updated_at'])