from survey.tests import BaseTest
from django.test import override_settings
from django.conf import settings
from django.test import tag
from survey import set_default_settings


@tag("set")
@override_settings()
class TestDefaultSettings(BaseTest):
    def test_set_choices_separator(self):
        url = "/admin/survey/survey/1/change/"
        del settings.CHOICES_SEPARATOR
        self.login()
        with self.assertRaises(AttributeError):
            self.client.get(url)
        set_default_settings()
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)

from survey.tests import BaseTest
from django.test import override_settings
from django.conf import settings
from survey import set_default_settings
from survey.exporter.tex.survey2tex import Survey2Tex


@override_settings()
class TestDefaultSettings(BaseTest):
    def test_set_choices_separator(self):
        url = "/admin/survey/survey/1/change/"
        del settings.CHOICES_SEPARATOR
        self.login()
        set_default_settings()
        try:
            self.client.get(url)
        except AttributeError:
            self.fail("AttributeError: survey failed to set CHOICES_SEPARATOR")

    def test_set_root(self):
        del settings.ROOT
        set_default_settings()
        try:
            Survey2Tex.generate(self, "/")
        except AttributeError:
            self.fail("AttributeError: survey failed to set ROOT")

Add - Test for setting ROOT
Add - Test for setting ROOT

  from survey.tests import BaseTest
  from django.test import override_settings
  from django.conf import settings
- from django.test import tag
  from survey import set_default_settings
+ from survey.exporter.tex.survey2tex import Survey2Tex
  
  
- @tag("set")
  @override_settings()
  class TestDefaultSettings(BaseTest):
      def test_set_choices_separator(self):
          url = "/admin/survey/survey/1/change/"
          del settings.CHOICES_SEPARATOR
          self.login()
-         with self.assertRaises(AttributeError):
+         set_default_settings()
+         try:
              self.client.get(url)
+         except AttributeError:
+             self.fail("AttributeError: survey failed to set CHOICES_SEPARATOR")
+ 
+     def test_set_root(self):
+         del settings.ROOT
          set_default_settings()
-         response = self.client.get(url)
-         self.assertEqual(response.status_code, 200)
+         try:
+             Survey2Tex.generate(self, "/")
+         except AttributeError:
+             self.fail("AttributeError: survey failed to set ROOT")
  
Add - Test for setting ROOT
## Code Before:
from survey.tests import BaseTest
from django.test import override_settings
from django.conf import settings
from django.test import tag
from survey import set_default_settings


@tag("set")
@override_settings()
class TestDefaultSettings(BaseTest):
    def test_set_choices_separator(self):
        url = "/admin/survey/survey/1/change/"
        del settings.CHOICES_SEPARATOR
        self.login()
        with self.assertRaises(AttributeError):
            self.client.get(url)
        set_default_settings()
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)

## Instruction:
Add - Test for setting ROOT
## Code After:
from survey.tests import BaseTest
from django.test import override_settings
from django.conf import settings
from survey import set_default_settings
from survey.exporter.tex.survey2tex import Survey2Tex


@override_settings()
class TestDefaultSettings(BaseTest):
    def test_set_choices_separator(self):
        url = "/admin/survey/survey/1/change/"
        del settings.CHOICES_SEPARATOR
        self.login()
        set_default_settings()
        try:
            self.client.get(url)
        except AttributeError:
            self.fail("AttributeError: survey failed to set CHOICES_SEPARATOR")

    def test_set_root(self):
        del settings.ROOT
        set_default_settings()
        try:
            Survey2Tex.generate(self, "/")
        except AttributeError:
            self.fail("AttributeError: survey failed to set ROOT")
