Esempio n. 1
0
 def test_url_check(self, client, artists):
     artist = artists[0]
     form = AlbumModelSelect2WidgetForm()
     assert form.as_p()
     field_id = signing.dumps(id(form.fields['artist'].widget))
     cache_key = form.fields['artist'].widget._get_cache_key()
     widget_dict = cache.get(cache_key)
     widget_dict['url'] = 'yet/another/url'
     cache.set(cache_key, widget_dict)
     url = reverse('django_select2:auto-json')
     response = client.get(url, {'field_id': field_id, 'term': artist.title})
     assert response.status_code == 404
 def test_url_check(self, client, artists):
     artist = artists[0]
     form = AlbumModelSelect2WidgetForm()
     assert form.as_p()
     field_id = signing.dumps(id(form.fields['artist'].widget))
     cache_key = form.fields['artist'].widget._get_cache_key()
     widget_dict = cache.get(cache_key)
     widget_dict['url'] = 'yet/another/url'
     cache.set(cache_key, widget_dict)
     url = reverse('django_select2-json')
     response = client.get(url, {
         'field_id': field_id,
         'term': artist.title
     })
     assert response.status_code == 404
Esempio n. 3
0
 def test_url_check(self, client, artists):
     artist = artists[0]
     form = AlbumModelSelect2WidgetForm()
     assert form.as_p()
     field_id = form.fields["artist"].widget.field_id
     cache_key = form.fields["artist"].widget._get_cache_key()
     widget_dict = cache.get(cache_key)
     widget_dict["url"] = "yet/another/url"
     cache.set(cache_key, widget_dict)
     url = reverse("django_select2:auto-json")
     response = client.get(url, {
         "field_id": field_id,
         "term": artist.title
     })
     assert response.status_code == 404
Esempio n. 4
0
def test_default_cache():
    from django_select2.cache import cache

    cache.set("key", "value")

    assert cache.get("key") == "value"
Esempio n. 5
0
def test_default_cache():
    from django_select2.cache import cache

    cache.set("key", "value")

    assert cache.get("key") == "value"
Esempio n. 6
0
def test_default_cache():
    from django_select2.cache import cache

    cache.set('key', 'value')

    assert cache.get('key') == 'value'
Esempio n. 7
0
def test_default_cache():
    from django_select2.cache import cache

    cache.set('key', 'value')

    assert cache.get('key') == 'value'