Пример #1
0
    def test_attach_validate_invalid_type(self, mocker):
        mock_request = mocker.MagicMock(data=dict(id='foobar'))
        serializer = SubListCreateAttachDetachAPIView()

        (sub_id, res) = serializer.attach_validate(mock_request)

        assert type(res) is Response
Пример #2
0
    def test_attach_validate_ok(self, mocker):
        mock_request = mocker.MagicMock(data=dict(id=1))
        serializer = SubListCreateAttachDetachAPIView()

        (sub_id, res) = serializer.attach_validate(mock_request)

        assert sub_id == 1
        assert res is None