Beispiel #1
0
    def test_modified_date_updates_when_target_updates(self):
        new_target = TargetFactory()
        snippet = ASRSnippetFactory()
        snippet.targets.add(new_target)
        old_modified = snippet.modified

        new_target.name = 'new name'
        new_target.save()
        snippet.refresh_from_db()
        new_modified = snippet.modified

        self.assertNotEqual(old_modified, new_modified)
    def test_modified_date_updates_when_target_updates(self):
        target = TargetFactory()
        job = JobFactory(targets=[target])
        snippet = job.snippet
        # Must refresh from db to get the actual datetime stored in db which
        # may be different by milliseconds from the original python datetime.
        snippet.refresh_from_db()
        old_modified = snippet.modified

        target.name = 'new name'
        target.save()
        snippet.refresh_from_db()
        new_modified = snippet.modified

        self.assertNotEqual(old_modified, new_modified)