• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rdmorganiser / rdmo / 20428555173

22 Dec 2025 10:02AM UTC coverage: 94.693% (-0.1%) from 94.814%
20428555173

Pull #1436

github

web-flow
Merge 0ffb48a5d into 57a75b09e
Pull Request #1436: Draft: add `rdmo.config` app for `Plugin` model (plugin managament)

2191 of 2304 branches covered (95.1%)

23411 of 24723 relevant lines covered (94.69%)

3.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.0
rdmo/services/validators.py
1
from rest_framework.serializers import ValidationError
4✔
2

3
from rdmo.config.constants import PluginType
4✔
4
from rdmo.config.models import Plugin
4✔
5

6

7
class ProviderValidator:
4✔
8

9
    def __call__(self, data):
4✔
10
        provider_key = data.get('provider_key')
4✔
11
        plugins = Plugin.objects.for_context(
4✔
12
            plugin_type=PluginType.PROJECT_ISSUE_PROVIDER,
13
            format=provider_key
14
        )
15
        provider = plugins.first().initialize_class() if plugins else None
4✔
16
        if provider is None:
4✔
17
            raise ValidationError({
4✔
18
                'provider_key': 'Please provide a valid provider.'
19
            })
20

21
        try:
4✔
22
            options = {option.get('key'): option.get('value') for option in data.get('options', [])}
4✔
23
        except KeyError as e:
×
24
            raise ValidationError({
×
25
                'options': 'Options need to be of the form "{"key": "": "value": ""}".'
26
            }) from e
27

28
        for key in options:
4✔
29
            if key not in [field.get('key') for field in provider.fields]:
4✔
30
                raise ValidationError({
4✔
31
                    'options': f'Key "{key}" is not valid.'
32
                })
33

34
        for field in provider.fields:
4✔
35
            if field.get('required', True) and field.get('key') not in options:
4✔
36
                raise ValidationError({
×
37
                    'options': 'Key "{}" is required.'.format(field.get('key'))
38
                })
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc