def connect(self): 
        try:
            self.connection = pymongo.Connection(self.host, self.port)
            self.db = self.connection[self.name]
        except AutoReconnect:
            raise DatabaseException("It's not possible connect to the database")
def test_validate_language_code_fails_when_language_codes_do_not_match(
            self):
        expected_suggestion_dict = self.suggestion_dict
        suggestion = suggestion_registry.SuggestionAddQuestion(
            expected_suggestion_dict['suggestion_id'],
            expected_suggestion_dict['target_id'],
            expected_suggestion_dict['target_version_at_submission'],
            expected_suggestion_dict['status'], self.author_id,
            self.reviewer_id, expected_suggestion_dict['change'],
            expected_suggestion_dict['score_category'],
            expected_suggestion_dict['language_code'], False, self.fake_date)
        expected_question_dict = (
            expected_suggestion_dict['change']['question_dict']
        )
        suggestion.validate()

        expected_question_dict['language_code'] = 'wrong_language_code'
        with self.assertRaisesRegex(
            utils.ValidationError,
            'Expected question language_code.wrong_language_code. to be same '
            'as suggestion language_code.en.'
        ):
            suggestion.validate()