コード例 #1
0
    def test_valid_topic_but_inexistent_should_raise_bad_requset(self, mock_search):
        params = {'topic_id': '1234'}
        
        mock_search.return_value = MockQuery(None)

        request = testing.DummyRequest(post=params)
        request.context = testing.DummyResource()

        with self.assertRaises(HTTPBadRequest):
            extract_topic(request)
コード例 #2
0
    def test_valid_topic_but_inexistent_should_raise_bad_requset(
            self, mock_search):
        params = {'topic_id': '1234'}

        mock_search.return_value = MockQuery(None)

        request = testing.DummyRequest(post=params)
        request.context = testing.DummyResource()

        with self.assertRaises(HTTPBadRequest):
            extract_topic(request)
コード例 #3
0
    def test_valid_topic_should_return_ids(self, mock_search):
        params = {'topic_id': '1234'}
        topic = factory.EdamFactory.build()

        mock_search.return_value = MockQuery(topic)

        request = testing.DummyRequest(post=params)
        request.context = testing.DummyResource()

        self.assertEqual(extract_topic(request), topic)
コード例 #4
0
    def test_valid_topic_should_return_ids(self, mock_search):
        params = {'topic_id': '1234'}
        topic = factory.EdamFactory.build()
        
        mock_search.return_value = MockQuery(topic)

        request = testing.DummyRequest(post=params)
        request.context = testing.DummyResource()

        self.assertEqual(extract_topic(request), topic)