text: # -*- coding: utf-8 -*-
  from django.test.client import Client
  
  from networkapi.test.test_case import NetworkApiTestCase
  from networkapi.util.geral import mount_url
  
  
  class RouteMapPostSuccessTestCase(NetworkApiTestCase):
  
      route_map_uri = '/api/v4/route-map/'
  
      fixtures = [
          'networkapi/config/fixtures/initial_config.json',
          'networkapi/system/fixtures/initial_variables.json',
          'networkapi/usuario/fixtures/initial_usuario.json',
          'networkapi/grupo/fixtures/initial_ugrupo.json',
          'networkapi/usuario/fixtures/initial_usuariogrupo.json',
          'networkapi/api_ogp/fixtures/initial_objecttype.json',
          'networkapi/api_ogp/fixtures/initial_objectgrouppermissiongeneral.json',
          'networkapi/grupo/fixtures/initial_permissions.json',
          'networkapi/grupo/fixtures/initial_permissoes_administrativas.json',
      ]
  
      json_path = 'api_route_map/v4/tests/route_map/sanity/json/post/{}'
  
      def setUp(self):
          self.client = Client()
          self.authorization = self.get_http_authorization('test')
          self.content_type = 'application/json'
          self.fields = ['name']
  
      def tearDown(self):
          pass
  
      def test_post_route_maps(self):
          """Test POST RouteMaps."""
  
          route_maps_path = self.json_path.\
              format('two_route_maps.json')
  
          response = self.client.post(
              self.route_map_uri,
              data=self.load_json(route_maps_path),
              content_type=self.content_type,
              HTTP_AUTHORIZATION=self.authorization)
  
          self.compare_status(201, response.status_code)
  
          get_ids = [data['id'] for data in response.data]
          uri = mount_url(self.route_map_uri,
                          get_ids,
                          kind=['basic'],
                          fields=self.fields)
  
          response = self.client.get(
              uri,
              HTTP_AUTHORIZATION=self.authorization
          )
  
          self.compare_status(200, response.status_code)
          self.compare_json(route_maps_path,
                            response.data)
  