@pytest.mark.django_db
def test_vfolder_priority_not_greater_than_zero(tp0):
 vfolder_item = {'name': 'whatever', 'priority': (-3), 'is_public': True, 'filter_rules': 'browser/defines.po'}
 with pytest.raises(ValidationError) as excinfo:
  VirtualFolder.objects.create(**vfolder_item)
 assert (u'Priority must be greater than zero.' in str(excinfo.value))
 vfolder_item['priority'] = 1
 vfolder = VirtualFolder.objects.create(**vfolder_item)
 vfolder.priority = 0
 with pytest.raises(ValidationError) as excinfo:
  vfolder.save()
 assert (u'Priority must be greater than zero.' in str(excinfo.value))

@ pytest . mark . django_db def test_vfolder_priority_not_greater_than_zero ( tp0 ) : vfolder_item = { 'name' : 'whatever' , 'priority' : ( - 3 ) , 'is_public' : True , 'filter_rules' : 'browser/defines.po' } with pytest . raises ( ValidationError ) as excinfo : VirtualFolder . objects . create ( ** vfolder_item ) assert ( u'Priority must be greater than zero.' in str ( excinfo . value ) ) vfolder_item [ 'priority' ] = 1 vfolder = VirtualFolder . objects . create ( ** vfolder_item ) vfolder . priority = 0 with pytest . raises ( ValidationError ) as excinfo : vfolder . save ( ) assert ( u'Priority must be greater than zero.' in str ( excinfo . value ) )
tests that the creation of a virtual folder fails if the provided priority is not greater than zero .