def test_no_next_snapshots(self): """ check that we do not look at ourself when searching next snapshots """ s1 = Snapshot(stepResult=self.tsr1, image=None, refSnapshot=None, pixelsDiff=None) s1.save() s2 = Snapshot(stepResult=self.tsr2, image=None, refSnapshot=s1, pixelsDiff=None) s2.save() self.assertEqual(s2.snapshotsUntilNextRef(s2.refSnapshot), [], "No next snapshot should be found")
def test_next_snapshots_with_no_ref(self): """ Search for next snapshot that reference ourself """ s1 = Snapshot(stepResult=self.tsr1, image=None, refSnapshot=None, pixelsDiff=None) s1.save() s2 = Snapshot(stepResult=self.tsr2, image=None, refSnapshot=s1, pixelsDiff=None) s2.save() # s3 should not be found has it does not reference s1 s3 = Snapshot(stepResult=self.tsr2, image=None, refSnapshot=s2, pixelsDiff=None) s3.save() self.assertEqual(s1.snapshotsUntilNextRef(s1), [s2], "One snapshot should be found")
def test_next_snapshots_with_ref(self): """ Check that the next reference snapshot (s4) is not rendered but pictures from the next version are """ # snapshots on app v1 s1 = Snapshot(stepResult=self.tsr1, image=None, refSnapshot=None, pixelsDiff=None) s1.save() s2 = Snapshot(stepResult=self.tsr2, image=None, refSnapshot=s1, pixelsDiff=None) s2.save() # snapshots on app v2 s3 = Snapshot(stepResult=self.tsr3, image=None, refSnapshot=s1, pixelsDiff=None) s3.save() s4 = Snapshot(stepResult=self.tsr4, image=None, refSnapshot=None, pixelsDiff=None) s4.save() self.assertEqual(s1.snapshotsUntilNextRef(s1), [s2, s3], "2 snapshots should be found")
def test_next_snapshots_with_lower_version(self): """ We should not give snapshots from a lower version even if snapshot id is lower We assume that 2 versions are being tested at the same time. Order of declared snapshots is important """ # snapshots on app v2 s0 = Snapshot(stepResult=self.tsr3, image=None, refSnapshot=None, pixelsDiff=None) s0.save() # snapshots on app v1 s1 = Snapshot(stepResult=self.tsr1, image=None, refSnapshot=None, pixelsDiff=None) s1.save() s2 = Snapshot(stepResult=self.tsr2, image=None, refSnapshot=s1, pixelsDiff=None) s2.save() # snapshots on app v2 s3 = Snapshot(stepResult=self.tsr4, image=None, refSnapshot=s0, pixelsDiff=None) s3.save() self.assertEqual(s1.snapshotsUntilNextRef(s1), [s2], "One snapshot should be found")