Exemplo n.º 1
0
    def test_valid_format_but_inexistent_should_raise_bad_requset(self, mock_search):
        params = {'format_id': '1234'}
        
        mock_search.return_value = MockQuery(None)

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

        with self.assertRaises(HTTPBadRequest):
            extract_format(request)
Exemplo n.º 2
0
    def test_valid_format_but_inexistent_should_raise_bad_requset(
            self, mock_search):
        params = {'format_id': '1234'}

        mock_search.return_value = MockQuery(None)

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

        with self.assertRaises(HTTPBadRequest):
            extract_format(request)
Exemplo n.º 3
0
    def test_valid_format_should_return_ids(self, mock_search):
        params = {'format_id': '1234'}
        format = factory.EdamFactory.build()

        mock_search.return_value = MockQuery(format)

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

        self.assertEqual(extract_format(request), format)
Exemplo n.º 4
0
    def test_valid_format_should_return_ids(self, mock_search):
        params = {'format_id': '1234'}
        format = factory.EdamFactory.build()
        
        mock_search.return_value = MockQuery(format)

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

        self.assertEqual(extract_format(request), format)