Beispiel #1
0
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)
Beispiel #2
0
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
Beispiel #3
0
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
Beispiel #4
0
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)