Exemple #1
0
def test__getTagsFromManifest(manifestOptions, expected):
    manifest = JobManifest()
    for varName, varValue in manifestOptions.items():
        manifest.setOption(varName, varValue)

    js = JobScheduling()
    tagList = js._getTagsFromManifest(manifest)
    assert set(tagList) == set(expected)
Exemple #2
0
def test__applySiteFilter(sites, banned, expected):
    js = JobScheduling()
    filtered = js._applySiteFilter(sites, banned)
    assert set(filtered) == set(expected)
Exemple #3
0
    def test__applySiteFilter(self):
        js = JobScheduling()

        sites = ['MY.Site1.org', 'MY.Site2.org']
        filtered = js._applySiteFilter(sites)
        self.assertEqual(set(filtered), set(sites))

        sites = ['MY.Site1.org', 'MY.Site2.org']
        banned = ['MY.Site1.org', 'MY.Site2.org']
        filtered = js._applySiteFilter(sites, banned)
        self.assertEqual(filtered, [])

        sites = ['MY.Site1.org', 'MY.Site2.org']
        banned = ['MY.Site2.org']
        filtered = js._applySiteFilter(sites, banned)
        self.assertEqual(filtered, ['MY.Site1.org'])

        sites = ['MY.Site1.org', 'MY.Site2.org']
        banned = []
        filtered = js._applySiteFilter(sites, banned)
        self.assertEqual(set(filtered), set(sites))

        sites = []
        banned = ['MY.Site1.org']
        filtered = js._applySiteFilter(sites, banned)
        self.assertEqual(set(filtered), set(sites))

        sites = []
        banned = []
        filtered = js._applySiteFilter(sites, banned)
        self.assertEqual(set(filtered), set(sites))

        sites = ['MY.Site1.org', 'MY.Site2.org']
        banned = ['MY.Site1.org']
        filtered = js._applySiteFilter(sites, banned)
        self.assertEqual(set(filtered), set(['MY.Site2.org']))

        sites = ['MY.Site1.org', 'MY.Site2.org']
        banned = ['MY.Site1.org', 'MY.Site3.org']
        filtered = js._applySiteFilter(sites, banned)
        self.assertEqual(set(filtered), set(['MY.Site2.org']))

        sites = []
        banned = ['MY.Site1.org', 'MY.Site3.org']
        filtered = js._applySiteFilter(sites, banned)
        self.assertEqual(set(filtered), set())

        sites = ['MY.Site1.org', 'MY.Site2.org']
        banned = ['MY.Site1.org', 'MY.Site3.org']
        filtered = js._applySiteFilter(sites, banned)
        self.assertEqual(set(filtered), set(['MY.Site2.org']))

        sites = ['MY.Site1.org', 'MY.Site2.org']
        banned = ['MY.Site4.org']
        filtered = js._applySiteFilter(sites, banned)
        self.assertEqual(set(filtered), set(sites))

        sites = ['MY.Site1.org', 'MY.Site2.org', 'MY.Site3.org']
        banned = ['MY.Site4.org']
        filtered = js._applySiteFilter(sites, banned)
        self.assertEqual(set(filtered), set(sites))

        sites = ['MY.Site1.org', 'MY.Site2.org']
        banned = ['MY.Site4.org']
        filtered = js._applySiteFilter(sites, banned)
        self.assertEqual(set(filtered), set(sites))
Exemple #4
0
def test__applySiteFilter(sites, banned, expected):
  js = JobScheduling()
  filtered = js._applySiteFilter(sites, banned)
  assert set(filtered) == set(expected)
Exemple #5
0
  def test__applySiteFilter( self ):
    js = JobScheduling()

    sites = ['MY.Site1.org', 'MY.Site2.org']
    filtered = js._applySiteFilter( sites )
    self.assertEqual( set( filtered ), set( sites ) )

    sites = ['MY.Site1.org', 'MY.Site2.org']
    banned = ['MY.Site1.org', 'MY.Site2.org']
    filtered = js._applySiteFilter( sites, banned )
    self.assertEqual( filtered, [] )

    sites = ['MY.Site1.org', 'MY.Site2.org']
    banned = ['MY.Site2.org']
    filtered = js._applySiteFilter( sites, banned )
    self.assertEqual( filtered, ['MY.Site1.org'] )

    sites = ['MY.Site1.org', 'MY.Site2.org']
    banned = []
    filtered = js._applySiteFilter( sites, banned )
    self.assertEqual( set( filtered ), set( sites ) )

    sites = []
    banned = ['MY.Site1.org']
    filtered = js._applySiteFilter( sites, banned )
    self.assertEqual( set( filtered ), set( sites ) )

    sites = []
    banned = []
    filtered = js._applySiteFilter( sites, banned )
    self.assertEqual( set( filtered ), set( sites ) )

    sites = ['MY.Site1.org', 'MY.Site2.org']
    banned = ['MY.Site1.org']
    filtered = js._applySiteFilter( sites, banned )
    self.assertEqual( set( filtered ), set( ['MY.Site2.org'] ) )

    sites = ['MY.Site1.org', 'MY.Site2.org']
    banned = ['MY.Site1.org', 'MY.Site3.org']
    filtered = js._applySiteFilter( sites, banned )
    self.assertEqual( set( filtered ), set( ['MY.Site2.org'] ) )

    sites = []
    banned = ['MY.Site1.org', 'MY.Site3.org']
    filtered = js._applySiteFilter( sites, banned )
    self.assertEqual( set( filtered ), set() )

    sites = ['MY.Site1.org', 'MY.Site2.org']
    banned = ['MY.Site1.org', 'MY.Site3.org']
    filtered = js._applySiteFilter( sites, banned )
    self.assertEqual( set( filtered ), set( ['MY.Site2.org'] ) )

    sites = ['MY.Site1.org', 'MY.Site2.org']
    banned = ['MY.Site4.org']
    filtered = js._applySiteFilter( sites, banned )
    self.assertEqual( set( filtered ), set( sites ) )

    sites = ['MY.Site1.org', 'MY.Site2.org', 'MY.Site3.org']
    banned = ['MY.Site4.org']
    filtered = js._applySiteFilter( sites, banned )
    self.assertEqual( set( filtered ), set( sites ) )

    sites = ['MY.Site1.org', 'MY.Site2.org']
    banned = ['MY.Site4.org']
    filtered = js._applySiteFilter( sites, banned )
    self.assertEqual( set( filtered ), set( sites ) )