old_contents: # -*- coding: utf-8 -*-
  from __future__ import absolute_import, unicode_literals
  from django.test import TestCase
  from django.db import IntegrityError
  
  from .factory import EnvironmentFactory
  
  
  class EnvironmentTestCase(TestCase):
  
      def setUp(self):
          self.host = EnvironmentFactory(name='production')
  
      def test_create_host(self):
  
          env = EnvironmentFactory()
          self.assertTrue(env.id)
  
      def test_unique_host(self):
  
          another_instance = self.env
          another_instance.id = None
  
          self.assertRaises(IntegrityError, another_instance.save)
  
new_contents: # -*- coding: utf-8 -*-
  from __future__ import absolute_import, unicode_literals
  from django.test import TestCase
  from django.db import IntegrityError
  
  from .factory import EnvironmentFactory
  
  
  class EnvironmentTestCase(TestCase):
  
      def setUp(self):
          self.env = EnvironmentFactory(name='production')
  
      def test_create_host(self):
  
          env = EnvironmentFactory()
          self.assertTrue(env.id)
  
      def test_unique_host(self):
  
          another_instance = self.env
          another_instance.id = None
  
          self.assertRaises(IntegrityError, another_instance.save)
  
subject: test fix