def test_insertion_success(self):
        params = {}
        params['server'] = 'mobiledata.bigdatacorp.com.br'
        params['port'] = '21766'
        params['database'] = 'MobileAppsData'
        params['username'] = '******'
        params['password'] = '******'
        params['seed_collection'] = 'Python_test'
        params['auth_database'] = 'MobileAppsData'
        params['write_concern'] = True

        mongo_uri = MongoDBWrapper.build_mongo_uri(**params)

        mongo_wrapper = MongoDBWrapper()

        is_connected = mongo_wrapper.connect(mongo_uri, params['database'],
                                             params['seed_collection'])

        unittest.skipIf(is_connected is False,
                     'Connection failed, insertion cancelled.')

        if is_connected:
            mongo_wrapper.insert_on_queue(self._test_app_url)

            # Find it on Mongo
            query = {'_id': self._test_app_url}
            self.assertTrue(mongo_wrapper._collection.find_one(query),
                            'Insert did not work.')

        else:
            self.fail('Connection problem, verify connection before insert.')
예제 #2
0
    def test_connection_success(self):
        params = {}
        params['server'] = 'mobiledata.bigdatacorp.com.br'
        params['port'] = '21766'
        params['database'] = 'MobileAppsData'
        params['username'] = '******'
        params['password'] = '******'
        params['seed_collection'] = 'Python_test'
        params['auth_database'] = 'MobileAppsData'
        params['write_concern'] = True

        mongo_uri = MongoDBWrapper.build_mongo_uri(**params)

        mongo_wrapper = MongoDBWrapper()
        is_connected = mongo_wrapper.connect(mongo_uri, params['database'],
                                             params['seed_collection'])

        self.assertTrue(is_connected, 'Failed to connect.')
    def test_connection_success(self):
        params = {}
        params['server'] = 'mobiledata.bigdatacorp.com.br'
        params['port'] = '21766'
        params['database'] = 'MobileAppsData'
        params['username'] = '******'
        params['password'] = '******'
        params['seed_collection'] = 'Python_test'
        params['auth_database'] = 'MobileAppsData'
        params['write_concern'] = True

        mongo_uri = MongoDBWrapper.build_mongo_uri(**params)

        mongo_wrapper = MongoDBWrapper()
        is_connected = mongo_wrapper.connect(mongo_uri, params['database'],
                                             params['seed_collection'])

        self.assertTrue(is_connected, 'Failed to connect.')
예제 #4
0
    def test_insertion_success(self):
        params = {}
        params['server'] = 'mobiledata.bigdatacorp.com.br'
        params['port'] = '21766'
        params['database'] = 'MobileAppsData'
        params['username'] = '******'
        params['password'] = '******'
        params['seed_collection'] = 'Python_test'
        params['auth_database'] = 'MobileAppsData'
        params['write_concern'] = True

        mongo_uri = MongoDBWrapper.build_mongo_uri(**params)

        mongo_wrapper = MongoDBWrapper()

        is_connected = mongo_wrapper.connect(mongo_uri, params['database'],
                                             params['seed_collection'])

        unittest.skipIf(is_connected is False,
                        'Connection failed, insertion cancelled.')

        if is_connected:
            mongo_wrapper.insert_on_queue(self._test_app_url)

            # Find it on Mongo
            query = {'_id': self._test_app_url}
            self.assertTrue(mongo_wrapper._collection.find_one(query),
                            'Insert did not work.')

        else:
            self.fail('Connection problem, verify connection before insert.')
예제 #5
0
    def test_build_uri_success(self):
        params = {}
        params['server'] = 'mobiledata.bigdatacorp.com.br'
        params['port'] = '21766'
        params['database'] = 'MobileAppsData'
        params['username'] = '******'
        params['password'] = '******'
        params['seed_collection'] = 'Python_test'
        params['auth_database'] = 'MobileAppsData'
        params['write_concern'] = True

        mongo_uri = MongoDBWrapper.build_mongo_uri(**params)

        self.assertTrue(mongo_uri == "mongodb://"\
        "GitHubCrawlerUser:[email protected]:21766/"\
        "?authSource=MobileAppsData&w=1&"\
        "readPreference=primaryPreferred&"\
        "connectTimeoutMS=16000&"\
        "socketTimeoutMS=16000" , 'URI incorrectly build.')
    def test_build_uri_success(self):
        params = {}
        params['server'] = 'mobiledata.bigdatacorp.com.br'
        params['port'] = '21766'
        params['database'] = 'MobileAppsData'
        params['username'] = '******'
        params['password'] = '******'
        params['seed_collection'] = 'Python_test'
        params['auth_database'] = 'MobileAppsData'
        params['write_concern'] = True

        mongo_uri = MongoDBWrapper.build_mongo_uri(**params)

        self.assertTrue(mongo_uri == "mongodb://"\
        "GitHubCrawlerUser:[email protected]:21766/"\
        "?authSource=MobileAppsData&w=1&"\
        "readPreference=primaryPreferred&"\
        "connectTimeoutMS=16000&"\
        "socketTimeoutMS=16000" , 'URI incorrectly build.')