Coverage for benefits/core/admin/transit.py: 100%
2 statements
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-30 22:14 +0000
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-30 22:14 +0000
1from django.contrib import admin
3from benefits.core import models
6@admin.register(models.TransitAgency)
7class TransitAgencyAdmin(admin.ModelAdmin): # pragma: no cover
8 def get_exclude(self, request, obj=None):
9 if not request.user.is_superuser:
10 return [
11 "eligibility_api_private_key",
12 "eligibility_api_public_key",
13 "transit_processor_client_id",
14 "transit_processor_client_secret_name",
15 "transit_processor_audience",
16 ]
17 else:
18 return super().get_exclude(request, obj)
20 def get_readonly_fields(self, request, obj=None):
21 if not request.user.is_superuser:
22 return [
23 "eligibility_api_id",
24 "transit_processor",
25 "index_template_override",
26 "eligibility_index_template_override",
27 ]
28 else:
29 return super().get_readonly_fields(request, obj)
32@admin.register(models.TransitProcessor)
33class TransitProcessorAdmin(admin.ModelAdmin): # pragma: no cover
34 def get_exclude(self, request, obj=None):
35 if not request.user.is_superuser:
36 return []
37 else:
38 return super().get_exclude(request, obj)
40 def get_readonly_fields(self, request, obj=None):
41 if not request.user.is_superuser:
42 return [
43 "card_tokenize_url",
44 "card_tokenize_func",
45 "card_tokenize_env",
46 ]
47 else:
48 return super().get_readonly_fields(request, obj)