

def test_cookies(self):
    CookieGroup.objects.create(varname='social', name='Social')
    Cookie.objects.create(cookiegroup=self.cookie_group, name='optional_test_cookie')
    url = reverse('test_page')
    response = self.client.get(url)
    self.assertContains(response, '"optional" cookies not accepted or declined')
    response = self.client.post(reverse('cookie_consent_accept', kwargs={
        'varname': 'optional',
    }))
    response = self.client.get(url)
    url.assertContains(response, '"optional" cookies accepted')
    self.assertEqual(self.client.cookies.get('optional_test_cookie').value, 'optional cookie set from django')
    response = self.client.post(reverse('cookie_consent_decline', kwargs={
        'varname': 'optional',
    }))
    response = self.client.get(url)
    self.assertContains(response, '"optional" cookies declined')
    self.assertFalse(self.client.cookies.get('optional_test_cookie').value)

dataset/ETHPy150Open bmihelac/django-cookie-consent/tests/core/tests/views_tests.py IntegrationTest.test_cookies/VarMisuse@105/151 `self`->`url`