Beispiel #1
0
    def test_overwrite_partial_uri(self, monkeypatch):
        """Check the case when connecting with partial `uri`."""
        monkeypatch.setattr(MongoDB, 'initiate_connection', lambda self: None)

        orion_db = MongoDB('mongodb://localhost',
                           port=1231,
                           name='orion',
                           username='******',
                           password='******')
        orion_db._sanitize_attrs()
        assert orion_db.host == 'localhost'
        assert orion_db.port == 1231
        assert orion_db.username == 'lala'
        assert orion_db.password == 'none'
        assert orion_db.name == 'orion'
Beispiel #2
0
    def test_overwrite_partial_uri(self, monkeypatch):
        """Check the case when connecting with partial `uri`."""
        monkeypatch.setattr(MongoDB, "initiate_connection", lambda self: None)

        orion_db = MongoDB(
            "mongodb://localhost",
            port=1231,
            name="orion",
            username="******",
            password="******",
        )
        orion_db._sanitize_attrs()
        assert orion_db.host == "localhost"
        assert orion_db.port == 1231
        assert orion_db.username == "lala"
        assert orion_db.password == "none"
        assert orion_db.name == "orion"