Ejemplo n.º 1
0
    def test_createsuperuser_non_ascii_verbose_name(self):
        # Aliased so the string doesn't get extracted
        from django.utils.translation import ugettext_lazy as ulazy
        username_field = User._meta.get_field('username')
        old_verbose_name = username_field.verbose_name
        username_field.verbose_name = ulazy('uživatel')
        new_io = StringIO()
        try:
            call_command("createsuperuser", interactive=True, stdout=new_io)
        finally:
            username_field.verbose_name = old_verbose_name

        command_output = new_io.getvalue().strip()
        self.assertEqual(command_output, 'Superuser created successfully.')
Ejemplo n.º 2
0
    def test_non_ascii_verbose_name(self):
        # Aliased so the string doesn't get extracted
        from django.utils.translation import ugettext_lazy as ulazy

        username_field = User._meta.get_field("username")
        old_verbose_name = username_field.verbose_name
        username_field.verbose_name = ulazy("u\u017eivatel")
        new_io = six.StringIO()
        try:
            call_command("createsuperuser", interactive=True, stdout=new_io, stdin=MockTTY())
        finally:
            username_field.verbose_name = old_verbose_name

        command_output = new_io.getvalue().strip()
        self.assertEqual(command_output, "Superuser created successfully.")