Exemplo n.º 1
0
    def test_timestamps_return_none_if_set_to_none(self):
        model = Model()
        model.unguard()

        timestamps = {
            'created_at': datetime.datetime.now(),
            'updated_at': datetime.datetime.now()
        }

        instance = model.new_instance(timestamps)
        instance.created_at = None

        self.assertIsNone(instance.created_at)

        model.reguard()
Exemplo n.º 2
0
    def test_timestamps_are_returned_as_objects_on_create(self):
        model = Model()
        model.unguard()

        timestamps = {
            'created_at': datetime.datetime.now(),
            'updated_at': datetime.datetime.now()
        }

        instance = model.new_instance(timestamps)

        self.assertIsInstance(instance.created_at, Arrow)
        self.assertIsInstance(instance.updated_at, Arrow)

        model.reguard()