@pytest.mark.django_db
def test_vfolder_with_no_filter_rules():
 vfolder_item = {'name': 'whatever', 'priority': 4, 'is_public': True, 'filter_rules': ''}
 with pytest.raises(ValidationError) as excinfo:
  VirtualFolder.objects.create(**vfolder_item)
 assert (u'Some filtering rule must be specified.' in str(excinfo.value))
 vfolder_item['filter_rules'] = 'FOO'
 vf = VirtualFolder.objects.create(**vfolder_item)
 vf.filter_rules = ''
 with pytest.raises(ValidationError) as excinfo:
  vf.save()
 assert (u'Some filtering rule must be specified.' in str(excinfo.value))

@ pytest . mark . django_db def test_vfolder_with_no_filter_rules ( ) : vfolder_item = { 'name' : 'whatever' , 'priority' : 4 , 'is_public' : True , 'filter_rules' : '' } with pytest . raises ( ValidationError ) as excinfo : VirtualFolder . objects . create ( ** vfolder_item ) assert ( u'Some filtering rule must be specified.' in str ( excinfo . value ) ) vfolder_item [ 'filter_rules' ] = 'FOO' vf = VirtualFolder . objects . create ( ** vfolder_item ) vf . filter_rules = '' with pytest . raises ( ValidationError ) as excinfo : vf . save ( ) assert ( u'Some filtering rule must be specified.' in str ( excinfo . value ) )
tests that the creation of a virtual folder fails if it doesnt have any filter rules .