Example #1
0
    def test_get_or_404_abort_none(self):
        ("Test that `get_or_404()` calls `abort()` with " "`NoDocumentFound`.")

        Model = mock.Mock()
        Model.NoDocumentFound = NoDocumentFound
        Model.get.side_effect = Model.NoDocumentFound

        with self.assertRaises(NotFound):
            get_or_404(Model, a=1)
Example #2
0
    def test_get_or_404_abort_none(self):
        ("Test that `get_or_404()` calls `abort()` with "
         "`NoDocumentFound`.")

        Model = mock.Mock()
        Model.NoDocumentFound = NoDocumentFound
        Model.get.side_effect = Model.NoDocumentFound

        with self.assertRaises(NotFound):
            get_or_404(Model, a=1)
Example #3
0
    def test_get_or_404(self):
        """Test the `get_or_404()` method."""

        expected = {'a': 1}

        Model = mock.Mock()
        Model.get.return_value = expected

        actual = get_or_404(Model, a=1)
        self.assertEqual(actual, expected)
Example #4
0
    def test_get_or_404(self):
        """Test the `get_or_404()` method."""

        expected = {'a': 1}

        Model = mock.Mock()
        Model.get.return_value = expected

        actual = get_or_404(Model, a=1)
        self.assertEqual(actual, expected)