def test_invalid_service_provider_type(rf, admin_user):
 get_default_shop()
 view = ServiceProviderEditView.as_view()
 url = '/?type=SomethingThatIsNotProvided'
 soup = get_bs_object_for_view(rf.get(url), view, admin_user)
 provider_form = soup.find('form', attrs={'id': 'service_provider_form'})
 type_select = provider_form.find('select', attrs={'id': 'id_type'})
 options = []
 for option in type_select.findAll('option'):
  options.append({'selected': bool(option.get('selected')), 'value': option['value']})
 assert (options[0]['selected'] is True)
 assert ([x['selected'] for x in options[1:]] == [False, False])

def test_invalid_service_provider_type ( rf , admin_user ) : get_default_shop ( ) view = ServiceProviderEditView . as_view ( ) url = '/?type=SomethingThatIsNotProvided' soup = get_bs_object_for_view ( rf . get ( url ) , view , admin_user ) provider_form = soup . find ( 'form' , attrs = { 'id' : 'service_provider_form' } ) type_select = provider_form . find ( 'select' , attrs = { 'id' : 'id_type' } ) options = [ ] for option in type_select . findAll ( 'option' ) : options . append ( { 'selected' : bool ( option . get ( 'selected' ) ) , 'value' : option [ 'value' ] } ) assert ( options [ 0 ] [ 'selected' ] is True ) assert ( [ x [ 'selected' ] for x in options [ 1 : ] ] == [ False , False ] )
test serviceprovideeditview with invalid type parameter .