def test_ifSkippingWorksWithCustomExtensionAndAbbreviation(self): """ Brief: Verify if skipping option works. Procedure: 1. Prepare a media file. 2. Program napiprojekt.pl mock 3. Call napi with a path to media to obtain the subtitles 4. Call napi again with option -s Expected Results: Napi should not attempt to download the subtitles the second as they already exist and the request to skip existing files has been done. """ media = None ext = "fancy-extension" abbrev = "abbreviation" with napi.sandbox.Sandbox() as sandbox: media = self.videoAssets.prepareRandomMedia(sandbox) # program http mock self.napiMock.programXmlRequest( media, napi.subtitles.CompressedSubtitles.fromString( media['asset'], "test subtitles"), None, None, 1) self.napiScan('--stats', '-e', ext, '-a', abbrev, media['path']) stats = self.output.parseNapiStats() self.assertEquals(1, stats['ok']) self.assertEquals(1, stats['total']) self.assertEquals(0, stats['unav']) napiFs = napi.fs.Filesystem(media) self.assertTrue(napiFs.subtitlesExists(None, ext, abbrev)) subsPaths = napiFs.getSubtitlesPaths(None, ext, abbrev) self.assertEquals(1, len(subsPaths)) # hashed file - to be able to track file content modifications subtitles = napi.fs.HashedFile(subsPaths[0]) self.napiScan('--stats', '-s', '-e', ext, '-a', abbrev, media['path']) stats = self.output.parseNapiStats() self.assertEquals(0, stats['ok']) self.assertEquals(1, stats['skip']) self.assertEquals(1, stats['total']) self.assertEquals(0, stats['unav']) # make sure the original content has not been modified self.assertFalse(subtitles.hasChanged())