django.test.TestCase - python examples

Here are the examples of the python api django.test.TestCase taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

0 View Complete Implementation :
Copyright MIT License
Author : GeeWee
def _run_test(serializer_cls, model_cls, sql_queries=1) -> ReturnList:
    Boilerplate for running the tests
    :return: the serializer data to astert one

        f'Running test with serializer "{serializer_cls.__name__}" and model {model_cls.__name__}'
    case = TestCase()
    request = APIRequestFactory().get("/FOO")

    with case.astertNumQueries(sql_queries):
        prefetched_queryset = prefetch(model_cls.objects.all(), serializer_cls)
        serializer_instance = serializer_cls(
            instance=prefetched_queryset, many=True, context={"request": request}
        print("Data returned:")