Add created field in ScannerResultSerializer (#14877)
This commit is contained in:
Родитель
d546c8989c
Коммит
385fef4f94
|
@ -27,3 +27,4 @@ This endpoint returns a list of labelled scanner results.
|
|||
:>json string scanner: The scanner name.
|
||||
:>json string label: Either ``good`` or ``bad``.
|
||||
:>json object results: The scanner (raw) results.
|
||||
:>json string created: The date the result was created, formatted with `this format <http://ecma-international.org/ecma-262/5.1/#sec-15.9.1.15>`_.
|
||||
|
|
|
@ -10,7 +10,7 @@ class ScannerResultSerializer(serializers.ModelSerializer):
|
|||
|
||||
class Meta:
|
||||
model = ScannerResult
|
||||
fields = ('id', 'scanner', 'label', 'results')
|
||||
fields = ('id', 'scanner', 'label', 'results', 'created')
|
||||
|
||||
def get_scanner(self, obj):
|
||||
return obj.get_scanner_name()
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from django.conf import settings
|
||||
|
||||
from olympia.amo.tests import TestCase
|
||||
from olympia.constants.scanners import CUSTOMS
|
||||
from olympia.scanners.models import ScannerResult
|
||||
|
@ -13,4 +15,7 @@ class TestScannerResultSerializer(TestCase):
|
|||
'scanner': result.get_scanner_name(),
|
||||
'label': None,
|
||||
'results': result.results,
|
||||
'created': result.created.strftime(
|
||||
settings.REST_FRAMEWORK['DATETIME_FORMAT']
|
||||
),
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче