Exemple #1
0
    def setUp(self):
        # Before 2.7.7, SCRAM-SHA-1 had to be enabled from the command line.
        if client_context.version < Version(2, 7, 7):
            cmd_line = client_context.cmd_line
            if 'SCRAM-SHA-1' not in cmd_line.get(
                    'parsed', {}).get('setParameter',
                    {}).get('authenticationMechanisms', ''):
                raise SkipTest('SCRAM-SHA-1 mechanism not enabled')

        client_context.create_user(
            'pymongo_test', 'user', 'pass', roles=['userAdmin', 'readWrite'])
Exemple #2
0
    def setUp(self):
        self.replica_set_name = client_context.replica_set_name

        # Before 2.7.7, SCRAM-SHA-1 had to be enabled from the command line.
        if client_context.version < Version(2, 7, 7):
            cmd_line = client_context.cmd_line
            if 'SCRAM-SHA-1' not in cmd_line.get('parsed', {}).get(
                    'setParameter', {}).get('authenticationMechanisms', ''):
                raise SkipTest('SCRAM-SHA-1 mechanism not enabled')

        client = client_context.rs_or_standalone_client
        client.pymongo_test.add_user('user',
                                     'pass',
                                     roles=['userAdmin', 'readWrite'],
                                     writeConcern={'w': client_context.w})