test_asyncresult -> test_tasks. Still updating this.

2019-08-17
Marnanel Thurman 2019-04-14 19:27:59 +01:00
rodzic 9dd211b728
commit 9ae34685e2
2 zmienionych plików z 18 dodań i 14 usunięć

Wyświetl plik

@ -1,12 +1,25 @@
from django.test import TestCase, Client
from django_kepi.models import Activity, QuarantinedMessage, QuarantinedMessageNeeds
from django_kepi.models import Activity
from django_kepi.validation import CachedPublicKey, IncomingMessage
from django_kepi import create
from things_for_testing import KepiTestCase
import logging
import httpretty
import json
class TestAsyncResult(KepiTestCase):
#########################
# Cases:
# - Request information; success
# - Request information; not found
# - Request information; GONE
# - Submit information; success
# - Submit information; fail
#
#########################
logger = logging.getLogger(name='django_kepi')
class TestTasks(KepiTestCase):
@httpretty.activate
def test_simple(self):

Wyświetl plik

@ -11,18 +11,9 @@ class KepiTestCase(TestCase):
def _mock_remote_object(self,
url,
ftype = 'Object',
fields = None,
content = '',
status = 200):
if fields is None:
fields = {}
if 'id' not in fields:
fields['id'] = url
if 'type' not in fields:
fields['type'] = ftype
headers = {
'Content-Type': 'application/activity+json',
}
@ -32,12 +23,12 @@ class KepiTestCase(TestCase):
url,
status=status,
headers=headers,
body=bytes(str(fields), encoding='UTF-8'))
body=bytes(content, encoding='UTF-8'))
logger.debug('Mocking %s as %d: %s',
url,
status,
fields)
content)
# For some reason, this allows Celery to
# access /async_result in the test version;