Example #1
0
    def test_guarantee_object_id_typeerror(self):
        """Test that `guarantee_object_id()` raises `TypeError`."""

        with self.assertRaises(TypeError):
            guarantee_object_id(1)

        with self.assertRaises(TypeError):
            guarantee_object_id([AN_OBJECT_ID_STR])
Example #2
0
    def test_guarantee_object_id_typeerror(self):
        """Test that `guarantee_object_id()` raises `TypeError`."""

        with self.assertRaises(TypeError):
            guarantee_object_id(1)

        with self.assertRaises(TypeError):
            guarantee_object_id([AN_OBJECT_ID_STR])
Example #3
0
    def test_guarantee_object_id(self):
        """Test the `guarantee_object_id()` method."""

        expected = AN_OBJECT_ID
        actual = guarantee_object_id(AN_OBJECT_ID_STR)

        self.assertEqual(actual, expected)
Example #4
0
    def test_guarantee_object_id(self):
        """Test the `guarantee_object_id()` method."""

        expected = AN_OBJECT_ID
        actual = guarantee_object_id(AN_OBJECT_ID_STR)

        self.assertEqual(actual, expected)
Example #5
0
    def test_guarantee_object_id_tuple(self):
        """Test the `guarantee_object_id()` method with a `tuple`."""

        expected = {
            '$in': [AN_OBJECT_ID, AN_OBJECT_ID],
        }
        actual = guarantee_object_id({
            '$in': (AN_OBJECT_ID_STR, AN_OBJECT_ID),
        })
        self.assertEqual(actual, expected)
Example #6
0
    def test_guarantee_object_id_tuple(self):
        """Test the `guarantee_object_id()` method with a `tuple`."""

        expected = {
            '$in': [AN_OBJECT_ID, AN_OBJECT_ID],
        }
        actual = guarantee_object_id({
            '$in': (AN_OBJECT_ID_STR, AN_OBJECT_ID),
        })
        self.assertEqual(actual, expected)
Example #7
0
    def test_guarantee_object_id_dict(self):
        """Test the `guarantee_object_id()` method with `dict`."""

        expected = {
            '$gt': AN_OBJECT_ID,
            '$lt': AN_OBJECT_ID,
        }
        actual = guarantee_object_id({
            '$gt': AN_OBJECT_ID_STR,
            '$lt': AN_OBJECT_ID,
        })
        self.assertEqual(actual, expected)
Example #8
0
    def test_guarantee_object_id_dict(self):
        """Test the `guarantee_object_id()` method with `dict`."""

        expected = {
            '$gt': AN_OBJECT_ID,
            '$lt': AN_OBJECT_ID,
        }
        actual = guarantee_object_id({
            '$gt': AN_OBJECT_ID_STR,
            '$lt': AN_OBJECT_ID,
        })
        self.assertEqual(actual, expected)
Example #9
0
    def test_guarantee_object_id_invalidid(self):
        """Test that `guarantee_object_id()` raises `InvalidId`."""

        with self.assertRaises(InvalidId):
            guarantee_object_id('abc')
Example #10
0
    def test_guarantee_object_id_invalidid(self):
        """Test that `guarantee_object_id()` raises `InvalidId`."""

        with self.assertRaises(InvalidId):
            guarantee_object_id('abc')