Patch django form field for testing
In case you're wondering how to patch Django form field for testing purposes (like URLField that passes local uri: file://...) here's how:
from .forms import ThatForm
from django import forms
class MyTests(TestCase):
def test_pass_url(self):
orig_url = ThatForm.base_fields['url']
ThatForm.base_fields['url'] = forms.CharField()
# ... do your thing #
# and just in case set original field back,
# if other tests need it:
ThatForm.base_fields['url'] = orig_url
Archiwum
- Luty 2016
- Październik 2015
- Wrzesień 2015
- Lipiec 2013
- Czerwiec 2013
- Kwiecień 2013
- Marzec 2013
- Grudzień 2011
- Listopad 2011
- Lipiec 2011
- Czerwiec 2011
- Luty 2010
- Wrzesień 2009
- Marzec 2009
- Luty 2009
In English