Beispiel #1
0
    def test_subscriber_not_found(self):
        controller = SubscriberController()

        status, _headers, _body = utils.invoke(
            controller,
            '/1234/not_found',
            method='GET',
        )

        assert status == '404 Not Found'
Beispiel #2
0
    def test_book_bookid_other(self):
        controller = SubscriberController()

        status, _headers, _body = utils.invoke(
            controller,
            '/1234/books/5678',
            method='OTHER',
        )

        assert status == '501 Not Implemented'
Beispiel #3
0
    def test_subscriber_index(self):
        controller = SubscriberController()

        status, _headers, body = utils.invoke(
            controller,
            '/',
            method='GET',
        )

        assert status == '200 OK'
        assert body == b'sub::index()'
Beispiel #4
0
    def test_book_bookid_delete(self):
        controller = SubscriberController()

        status, _headers, body = utils.invoke(
            controller,
            '/1234/books/5678',
            method='DELETE',
        )

        assert status == '200 OK'
        assert body == b'book::delete(book_id=5678, sub_id=1234)'
Beispiel #5
0
    def test_book_create(self):
        controller = SubscriberController()

        status, _headers, body = utils.invoke(
            controller,
            '/1234/books',
            method='POST',
        )

        assert status == '200 OK'
        assert body == b'book::create(sub_id=1234)'
Beispiel #6
0
    def test_subscriber_subid_delete(self):
        controller = SubscriberController()

        status, _headers, body = utils.invoke(
            controller,
            '/1234',
            method='DELETE',
        )

        assert status == '200 OK'
        assert body == b'sub::delete(sub_id=1234)'
Beispiel #7
0
    def test_book_bookid_options(self):
        controller = SubscriberController()

        status, headers, body = utils.invoke(
            controller,
            '/1234/books/5678',
            method='OPTIONS',
        )

        assert status == '204 No Content'
        assert 'allow' in headers
        assert headers['allow'] == 'DELETE,GET,HEAD,OPTIONS,PUT'
        assert body == b''
Beispiel #8
0
    def test_subscriber_options(self):
        controller = SubscriberController()

        status, headers, body = utils.invoke(
            controller,
            '/',
            method='OPTIONS',
        )

        assert status == '204 No Content'
        assert 'allow' in headers
        assert headers['allow'] == 'GET,HEAD,OPTIONS,POST'
        assert body == b''