def testWildcardKeepsSpecificSelectionsForPriorityHarvesting(self): selectionPath = join(self.tempdir, 'subdir', 'repository_sets_selection.json') setsSelection = SetsSelection(selectionPath) self.assertFalse(setsSelection.isSelected('abc')) setsSelection.addToSelection('abc') setsSelection.addToSelection(WILDCARD) setsSelection.addToSelection('def') self.assertEquals([WILDCARD, 'abc', 'def'], list(setsSelection.selectedSetSpecs())) self.assertTrue(setsSelection.isSelected('abc')) self.assertTrue(setsSelection.isSelected('xyz'))
def testWildcard(self): selectionPath = join(self.tempdir, 'subdir', 'repository_sets_selection.json') setsSelection = SetsSelection(selectionPath) self.assertFalse(setsSelection.isSelected('abc')) self.assertEquals([], list(setsSelection.selectedSetSpecs())) setsSelection.addToSelection(WILDCARD) self.assertEquals([WILDCARD], list(setsSelection.selectedSetSpecs())) self.assertTrue(setsSelection.isSelected('abc'))
def testSelectedSetSpecs(self): selectionPath = join(self.tempdir, 'subdir', 'repository_sets_selection.json') setsSelection = SetsSelection(selectionPath) self.assertEquals([], list(setsSelection.selectedSetSpecs())) setsSelection.addToSelection('kb') setsSelection.addToSelection('beng') setsSelection.addToSelection('nationaal_archief') setsSelection.addToSelection('open_beelden:beeldengeluid') self.assertEquals(['beng', 'kb', 'nationaal_archief', 'open_beelden:beeldengeluid'], list(setsSelection.selectedSetSpecs())) self.assertTrue(setsSelection.isSelected('kb')) self.assertTrue(setsSelection.isSelected('open_beelden:beeldengeluid')) setsSelection = SetsSelection(selectionPath) self.assertEquals(['beng', 'kb', 'nationaal_archief', 'open_beelden:beeldengeluid'], list(setsSelection.selectedSetSpecs())) setsSelection.addToSelection('open_beelden:openimages') self.assertEqualsWS("""[ "beng", "kb", "nationaal_archief", "open_beelden:beeldengeluid", "open_beelden:openimages" ]""", open(selectionPath).read()) setsSelection.addToSelection('open_beelden') self.assertEqualsWS("""[ "beng", "kb", "nationaal_archief", "open_beelden", "open_beelden:beeldengeluid", "open_beelden:openimages" ]""", open(selectionPath).read())