'Test registering an indexed WMS'

def test_register_indexed_wms(self):

    self.client.login(username='admin', password='admin')
    response = self.client.post(reverse('register_service'), {'type': 'WMS', 'url': 'http://metaspatial.net/cgi-bin/ogc-wms.xml'})
    self.assertEqual(response.status_code, 200)
    service_dict = json.loads(response.content)[0]
    try:
        service = Service.objects.get(id=service_dict['service_id'])
        self.assertTrue((ServiceLayer.objects.filter(service=service).count() > 0))
        self.assertEqual(service.method, 'I')
        self.assertEqual(service.type, 'WMS')
        self.assertEqual(service.ptype, 'gxp_wmscsource')
    except Exception as e:
        traceback.print_exc(file=sys.stdout)
        self.fail(('Service    not    created:    %s' % str(e)))
