Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_delete(self):
n = TestElement()
n.delete()
self.assertTrue(n.timestamps.dirty)
self.assertTrue(n.timestamps.deleted > node.NodeTimestamps.int_to_dt(0))
def test_trashed(self):
n = TestElement()
self.assertFalse(n.trashed)
n.timestamps.trashed = None
self.assertFalse(n.trashed)
n.timestamps.trashed = node.NodeTimestamps.int_to_dt(0)
self.assertFalse(n.trashed)
n.timestamps.trashed = node.NodeTimestamps.int_to_dt(1)
self.assertTrue(n.trashed)
def test_deleted(self):
n = TestElement()
self.assertFalse(n.deleted)
n.timestamps.deleted = None
self.assertFalse(n.deleted)
n.timestamps.deleted = node.NodeTimestamps.int_to_dt(0)
self.assertFalse(n.deleted)
n.timestamps.deleted = node.NodeTimestamps.int_to_dt(1)
self.assertTrue(n.deleted)
def __init__(self):
super(Label, self).__init__()
create_time = time.time()
self.id = self._generateId(create_time)
self._name = ''
self.timestamps = NodeTimestamps(create_time)
self._merged = NodeTimestamps.int_to_dt(0)
def trashed(self):
return self.timestamps.trashed > NodeTimestamps.int_to_dt(0)
def trashed(self, value):
self.timestamps.trashed = datetime.datetime.utcnow() if value else NodeTimestamps.int_to_dt(0)
self.touch()
def _load(self, raw):
super(NodeDrawingInfo, self)._load(raw)
self.drawing_id = raw['drawingId']
self.snapshot.load(raw['snapshotData'])
self._snapshot_fingerprint = raw['snapshotFingerprint'] if 'snapshotFingerprint' in raw else self._snapshot_fingerprint
self._thumbnail_generated_time = NodeTimestamps.str_to_dt(raw['thumbnailGeneratedTime']) if 'thumbnailGeneratedTime' in raw else NodeTimestamps.int_to_dt(0)
self._ink_hash = raw['inkHash'] if 'inkHash' in raw else ''
self._snapshot_proto_fprint = raw['snapshotProtoFprint'] if 'snapshotProtoFprint' in raw else self._snapshot_proto_fprint