old_contents: from __future__ import unicode_literals
  
  from django.test import TestCase
  
  from .models import AutonomousSystem
  
  
  class AutonomousSystemTestCase(TestCase):
      def test_does_exist(self):
          asn = 29467
  
          # AS should not exist
          autonomous_system = AutonomousSystem.does_exist(asn)
          self.assertEqual(None, autonomous_system)
  
          # Create the AS
          values = {
              'asn': asn,
              'name': 'LuxNetwork S.A.',
          }
          new_as = AutonomousSystem(**values)
          new_as.save()
  
          # AS must exist
          autonomous_system = AutonomousSystem.does_exist(asn)
          self.assertEqual(asn, new_as.asn)
  
      def test_create_from_peeringdb(self):
          asn = 29467
  
          # Create the AS
          autonomous_system1 = AutonomousSystem.create_from_peeringdb(29467)
          self.assertEqual(29467, autonomous_system1.asn)
  
          # Must not rise error, just return the AS
          autonomous_system2 = AutonomousSystem.create_from_peeringdb(29467)
          self.assertEqual(29467, autonomous_system2.asn)
  
new_contents: from __future__ import unicode_literals
  
  from django.test import TestCase
  
  from .models import AutonomousSystem
  
  
  class AutonomousSystemTestCase(TestCase):
      def test_does_exist(self):
          asn = 29467
  
          # AS should not exist
          autonomous_system = AutonomousSystem.does_exist(asn)
          self.assertEqual(None, autonomous_system)
  
          # Create the AS
          new_as = AutonomousSystem.objects.create(asn=asn,
                                                   name='LuxNetwork S.A.')
  
          # AS must exist
          autonomous_system = AutonomousSystem.does_exist(asn)
          self.assertEqual(asn, new_as.asn)
  
      def test_create_from_peeringdb(self):
          asn = 29467
  
          # Must not exist at first
          self.assertEqual(None, AutonomousSystem.does_exist(asn))
  
          # Create the AS
          autonomous_system1 = AutonomousSystem.create_from_peeringdb(asn)
          self.assertEqual(asn, autonomous_system1.asn)
  
          # Must exist now
          self.assertEqual(asn, AutonomousSystem.does_exist(asn).asn)
  
          # Must not rise error, just return the AS
          autonomous_system2 = AutonomousSystem.create_from_peeringdb(asn)
          self.assertEqual(asn, autonomous_system2.asn)
  
          # Must exist now also
          self.assertEqual(asn, AutonomousSystem.does_exist(asn).asn)
  
subject: Improve tests for AutonomousSystem.