Tests for custome index names

from django.contrib.gis.db import models

class Shop(models.Model):
name = models.CharField(max_length=100)
location = models.PointField()
address = models.CharField(max_length=100)
city = models.CharField(max_length=50)
class Meta:
indexes = [
models.Index(fields=[‘location’],name=‘custome_index_name’),
]

how can i write the test to check whether the index created is of specified name

Have a look here: https://github.com/django/django/blob/fc4f45ebdccd87f140f39bebed897053c7f345c5/tests/indexes/tests.py#L34-L56

Basically we check that the index name the DB creates is as expected.

More generally you can query the state of the DB using the low-level connection.

HTH