Example #1
0
    def test_set_write_concern_as_safe_with_w(self):
        """Test the `set_write_concern_as_safe()` method with `w`."""

        options = {'w': 1}
        set_write_concern_as_safe(options, False)
        self.assertEqual(options, {'safe': True})

        options = {'w': 0}
        set_write_concern_as_safe(options, False)
        self.assertEqual(options, {'safe': False})

        options = {'w': 0}
        set_write_concern_as_safe(options, True)
        self.assertEqual(options, {'safe': True})
Example #2
0
    def test_set_write_concern_as_safe_with_w(self):
        """Test the `set_write_concern_as_safe()` method with `w`."""

        options = {'w': 1}
        set_write_concern_as_safe(options, False)
        self.assertEqual(options, {'safe': True})

        options = {'w': 0}
        set_write_concern_as_safe(options, False)
        self.assertEqual(options, {'safe': False})

        options = {'w': 0}
        set_write_concern_as_safe(options, True)
        self.assertEqual(options, {'safe': True})
Example #3
0
    def test_set_write_concern_as_safe(self):
        """Test the `set_write_concern_as_safe()` method."""

        options = {'safe': True}
        set_write_concern_as_safe(options, False)
        self.assertEqual(options, {'safe': True})

        options = {'safe': False}
        set_write_concern_as_safe(options, False)
        self.assertEqual(options, {'safe': False})

        options = {'safe': False}
        set_write_concern_as_safe(options, True)
        self.assertEqual(options, {'safe': True})
Example #4
0
    def test_set_write_concern_as_safe(self):
        """Test the `set_write_concern_as_safe()` method."""

        options = {'safe': True}
        set_write_concern_as_safe(options, False)
        self.assertEqual(options, {'safe': True})

        options = {'safe': False}
        set_write_concern_as_safe(options, False)
        self.assertEqual(options, {'safe': False})

        options = {'safe': False}
        set_write_concern_as_safe(options, True)
        self.assertEqual(options, {'safe': True})