def test_choice(self):
     rf = ResourceField('f', {
         'example': 'mpm',
         'choices': [
             'prefork',
             'worker'
         ]
     })
     rf.check_choice('prefork')
 def test_choice_callable(self):
     callable = mock.Mock(return_value=[
         'prefork',
         'worker'
     ])
     rf = ResourceField('f', {
         'example': 'mpm',
         'choices': callable
     })
     assert not callable.reset_mock()
     rf.check_choice('prefork')
     callable.assert_called_once_with()
Esempio n. 3
0
 def test_choice_callable(self):
     callable = mock.Mock(return_value=['prefork', 'worker'])
     rf = ResourceField('f', {'example': 'mpm', 'choices': callable})
     assert not callable.reset_mock()
     rf.check_choice('prefork')
     callable.assert_called_once_with()
Esempio n. 4
0
 def test_choice(self):
     rf = ResourceField('f', {
         'example': 'mpm',
         'choices': ['prefork', 'worker']
     })
     rf.check_choice('prefork')