예제 #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)
예제 #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
예제 #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
예제 #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)
예제 #5
0
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)
예제 #6
0
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)