def test_message_flag_view_only_accepts_post(self):
        def check_http_method(method, klass):
            """Check HTTP functions"""
            request = getattr(self.request_factory, method)('/')
            request.user = self.staff_user
            result = views.message_flag_view(request, self.message1.pk)
            self.assertIsInstance(result, klass)

        for method in ('put', 'get', 'head', 'delete', 'options'):
            check_http_method(method, HttpResponseNotAllowed)

        check_http_method('post', HttpResponse)
view should return HttpResponseNotAllowed if request isn't POST.
dataset/ETHPy150Open ofa/connect/open_connect/connectmessages/tests/test_views.py/MessageFlagViewTest.test_message_flag_view_only_accepts_post