def test_read_only_view_set_retrieve_data_found(): viewset_under_test = ReadOnlyViewSet() viewset_under_test.serializer_class = DummySerializer viewset_under_test.data_provider_class = DummyProvider assert isinstance(viewset_under_test.retrieve(EMPTY_REQUEST, 'test1'), Response)
def test_read_only_view_set_retrieve_data_not_found(): viewset_under_test = ReadOnlyViewSet() viewset_under_test.serializer_class = DummySerializer viewset_under_test.data_provider_class = DummyProvider with pytest.raises(NotFound): response = viewset_under_test.retrieve(EMPTY_REQUEST, 'test3') assert response.status_code == 404
def test_read_only_view_set_list(): viewset_under_test = ReadOnlyViewSet() viewset_under_test.serializer_class = DummySerializer viewset_under_test.data_provider_class = DummyProvider assert isinstance(viewset_under_test.list(EMPTY_REQUEST), Response)