• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python api.unique_identities函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sortinghat.api.unique_identities函数的典型用法代码示例。如果您正苦于以下问题:Python unique_identities函数的具体用法?Python unique_identities怎么用?Python unique_identities使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了unique_identities函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_unify_fast_matching

    def test_unify_fast_matching(self):
        """Test unify method using a default matcher and fast matching mode"""

        before = api.unique_identities(self.db)
        self.assertEqual(len(before), 6)

        code = self.cmd.unify(matching='default', fast_matching=True)
        self.assertEqual(code, CMD_SUCCESS)

        after = api.unique_identities(self.db)
        self.assertEqual(len(after), 5)

        # jsmith identities with same email address
        jsmith = after[0]
        self.assertEqual(jsmith.uuid, '178315df7941fc76a6ffb06fd5b00f6932ad9c41')

        identities = jsmith.identities
        identities.sort(key=lambda x: x.id)

        self.assertEqual(len(identities), 7)

        id_ = identities[1]
        self.assertEqual(id_.email, '[email protected]')
        self.assertEqual(id_.source, 'mls')

        id_ = identities[3]
        self.assertEqual(id_.email, '[email protected]')
        self.assertEqual(id_.source, 'scm')

        output = sys.stdout.getvalue().strip()
        self.assertEqual(output, UNIFY_DEFAULT_OUTPUT)
开发者ID:MetricsGrimoire,项目名称:sortinghat,代码行数:31,代码来源:test_cmd_unify.py


示例2: test_unify

    def test_unify(self):
        """Test unify method using a default matcher"""

        before = api.unique_identities(self.db)
        self.assertEqual(len(before), 6)

        code = self.cmd.unify(matching='default')
        self.assertEqual(code, CMD_SUCCESS)

        after = api.unique_identities(self.db)
        self.assertEqual(len(after), 5)

        # jsmith identities with same email address
        jsmith = after[1]
        self.assertEqual(jsmith.uuid, '72ae225d363c83456d788da14eeb0718efe7a0fc')

        identities = jsmith.identities
        identities.sort(key=lambda x: x.id)

        self.assertEqual(len(identities), 7)

        id_ = identities[0]
        self.assertEqual(id_.email, '[email protected]')
        self.assertEqual(id_.source, 'mls')

        id_ = identities[2]
        self.assertEqual(id_.email, '[email protected]')
        self.assertEqual(id_.source, 'scm')

        output = sys.stdout.getvalue().strip()
        self.assertEqual(output, UNIFY_DEFAULT_OUTPUT)
开发者ID:geekygirldawn,项目名称:sortinghat,代码行数:31,代码来源:test_cmd_unify.py


示例3: test_unify_email_name_matcher

    def test_unify_email_name_matcher(self):
        """Test unify method using the email-name matcher"""

        before = api.unique_identities(self.db)
        self.assertEqual(len(before), 6)

        code = self.cmd.unify(matching='email-name')
        self.assertEqual(code, CMD_SUCCESS)

        after = api.unique_identities(self.db)
        self.assertEqual(len(after), 3)

        output = sys.stdout.getvalue().strip()
        self.assertEqual(output, UNIFY_EMAIL_NAME_OUTPUT)
开发者ID:MetricsGrimoire,项目名称:sortinghat,代码行数:14,代码来源:test_cmd_unify.py


示例4: test_unify_no_strict

    def test_unify_no_strict(self):
        """Test unify method with no strict mode set"""

        before = api.unique_identities(self.db)
        self.assertEqual(len(before), 6)

        code = self.cmd.unify(matching='email-name',
                              no_strict_matching=True)
        self.assertEqual(code, CMD_SUCCESS)

        after = api.unique_identities(self.db)
        self.assertEqual(len(after), 2)

        output = sys.stdout.getvalue().strip()
        self.assertEqual(output, UNIFY_NO_STRICT_OUTPUT)
开发者ID:MetricsGrimoire,项目名称:sortinghat,代码行数:15,代码来源:test_cmd_unify.py


示例5: test_dates_out_of_bounds

    def test_dates_out_of_bounds(self):
        """Check dates when they are out of bounds"""

        parser = self.get_parser(datadir('sortinghat_ids_dates_out_of_bounds.json'))

        # This command returns a success value even when some data is wrong
        code = self.cmd.import_identities(parser)
        self.assertEqual(code, CMD_SUCCESS)

        # Check the contents of the registry
        uids = api.unique_identities(self.db)
        self.assertEqual(len(uids), 1)

        # Jane Roe
        uid = uids[0]
        self.assertEqual(uid.uuid, '17ab00ed3825ec2f50483e33c88df223264182ba')

        enrollments = api.enrollments(self.db, uid.uuid)
        self.assertEqual(len(enrollments), 2)

        rol0 = enrollments[0]
        self.assertEqual(rol0.organization.name, 'Bitergia')
        self.assertEqual(rol0.start, datetime.datetime(1999, 1, 1, 0, 0))
        # The json file has 2200-01-01T00:00:00
        self.assertEqual(rol0.end, datetime.datetime(2100, 1, 1, 0, 0))

        rol1 = enrollments[1]
        self.assertEqual(rol1.organization.name, 'Example')
        # The json file has 1800-01-01T00:00:00
        self.assertEqual(rol1.start, datetime.datetime(1900, 1, 1, 0, 0))
        self.assertEqual(rol1.end, datetime.datetime(2100, 1, 1, 0, 0))
开发者ID:acs,项目名称:sortinghat,代码行数:31,代码来源:test_cmd_load.py


示例6: test_unify_with_blacklist

    def test_unify_with_blacklist(self):
        """Test unify method using a blacklist"""

        # Add some entries to the blacklist
        api.add_to_matching_blacklist(self.db, 'Jane Rae Doe')
        api.add_to_matching_blacklist(self.db, '[email protected]')

        before = api.unique_identities(self.db)
        self.assertEqual(len(before), 6)

        code = self.cmd.unify(matching='default')
        self.assertEqual(code, CMD_SUCCESS)

        # No match was found
        after = api.unique_identities(self.db)
        self.assertEqual(len(after), 6)
开发者ID:MetricsGrimoire,项目名称:sortinghat,代码行数:16,代码来源:test_cmd_unify.py


示例7: test_unify_with_sources_list

    def test_unify_with_sources_list(self):
        """Test unify method using a sources list"""

        sources = ['mls', 'alt']

        before = api.unique_identities(self.db)
        self.assertEqual(len(before), 6)

        code = self.cmd.unify(matching='email-name', sources=sources)
        self.assertEqual(code, CMD_SUCCESS)

        # Only jrae identities are merged
        after = api.unique_identities(self.db)
        self.assertEqual(len(after), 5)

        output = sys.stdout.getvalue().strip()
        self.assertEqual(output, UNIFY_SOURCES_OUTPUT)
开发者ID:MetricsGrimoire,项目名称:sortinghat,代码行数:17,代码来源:test_cmd_unify.py


示例8: test_valid_identities_already_exist

    def test_valid_identities_already_exist(self):
        """Check method when an identity already exists but with distinct UUID"""

        # The identity already exists but with a different UUID
        uuid = api.add_identity(self.db, 'unknown', email='[email protected]')
        api.add_identity(self.db, source='scm', email='[email protected]',
                         name='John Smith', username='jsmith', uuid=uuid)
        api.edit_profile(self.db, uuid, name='John Smith', is_bot=False,
                         country_code='US')

        parser = self.get_parser('data/sortinghat_valid.json')

        code = self.cmd.import_identities(parser)
        self.assertEqual(code, CMD_SUCCESS)

        # Check the contents of the registry
        uids = api.unique_identities(self.db)
        self.assertEqual(len(uids), 2)

        # John Smith
        uid = uids[0]
        self.assertEqual(uid.uuid, '23fe3a011190a27a7c5cf6f8925de38ff0994d8d')

        # The profile was not updated because it was already available
        prf = uid.profile
        self.assertEqual(prf.uuid, '23fe3a011190a27a7c5cf6f8925de38ff0994d8d')
        self.assertEqual(prf.name, 'John Smith')
        self.assertEqual(prf.email, None)
        self.assertEqual(prf.is_bot, False)
        self.assertEqual(prf.country_code, 'US')
        self.assertEqual(prf.country.code, 'US')
        self.assertEqual(prf.country.name, 'United States of America')

        ids = self.sort_identities(uid.identities)
        self.assertEqual(len(ids), 3)

        id0 = ids[0]
        self.assertEqual(id0.id, '03e12d00e37fd45593c49a5a5a1652deca4cf302')
        self.assertEqual(id0.name, 'John Smith')
        self.assertEqual(id0.email, '[email protected]')
        self.assertEqual(id0.username, 'jsmith')
        self.assertEqual(id0.source, 'scm')

        id1 = ids[1]
        self.assertEqual(id1.id, '23fe3a011190a27a7c5cf6f8925de38ff0994d8d')
        self.assertEqual(id1.name, None)
        self.assertEqual(id1.email, '[email protected]')
        self.assertEqual(id1.username, None)
        self.assertEqual(id1.source, 'unknown')

        id2 = ids[2]
        self.assertEqual(id2.id, '75d95d6c8492fd36d24a18bd45d62161e05fbc97')
        self.assertEqual(id2.name, 'John Smith')
        self.assertEqual(id2.email, '[email protected]')
        self.assertEqual(id2.username, None)
        self.assertEqual(id2.source, 'scm')
开发者ID:geekygirldawn,项目名称:sortinghat,代码行数:56,代码来源:test_cmd_load.py


示例9: test_valid_identities_already_exist

    def test_valid_identities_already_exist(self):
        """Check method when an identity already exists but with distinct UUID"""

        # The identity already exists but with a different UUID
        uuid = api.add_identity(self.db, 'unknown', email='[email protected]')
        api.add_identity(self.db, source='scm', email='[email protected]',
                         name='John Smith', username='jsmith', uuid=uuid)
        api.edit_profile(self.db, uuid, name='John Smith', is_bot=False,
                         country_code='US')

        parser = self.get_parser(datadir('sortinghat_valid.json'))

        code = self.cmd.import_identities(parser)
        self.assertEqual(code, CMD_SUCCESS)

        # Check the contents of the registry
        uids = api.unique_identities(self.db)
        self.assertEqual(len(uids), 2)

        # John Smith
        uid = uids[1]
        self.assertEqual(uid.uuid, '2371a34a0ac65fbd9d631464ee41d583ec0e1e88')

        # The profile is updated because a new one was given
        prf = uid.profile
        self.assertEqual(prf.uuid, '2371a34a0ac65fbd9d631464ee41d583ec0e1e88')
        self.assertEqual(prf.name, None)
        self.assertEqual(prf.email, '[email protected]')
        self.assertEqual(prf.gender, 'male')
        self.assertEqual(prf.gender_acc, 100)
        self.assertEqual(prf.is_bot, True)
        self.assertEqual(prf.country, None)

        ids = self.sort_identities(uid.identities)
        self.assertEqual(len(ids), 3)

        id0 = ids[0]
        self.assertEqual(id0.id, '2371a34a0ac65fbd9d631464ee41d583ec0e1e88')
        self.assertEqual(id0.name, None)
        self.assertEqual(id0.email, '[email protected]')
        self.assertEqual(id0.username, None)
        self.assertEqual(id0.source, 'unknown')

        id1 = ids[1]
        self.assertEqual(id1.id, '880b3dfcb3a08712e5831bddc3dfe81fc5d7b331')
        self.assertEqual(id1.name, 'John Smith')
        self.assertEqual(id1.email, '[email protected]')
        self.assertEqual(id1.username, None)
        self.assertEqual(id1.source, 'scm')

        id2 = ids[2]
        self.assertEqual(id2.id, 'a9b403e150dd4af8953a52a4bb841051e4b705d9')
        self.assertEqual(id2.name, 'John Smith')
        self.assertEqual(id2.email, '[email protected]')
        self.assertEqual(id2.username, 'jsmith')
        self.assertEqual(id2.source, 'scm')
开发者ID:acs,项目名称:sortinghat,代码行数:56,代码来源:test_cmd_load.py


示例10: test_identities_load_file

    def test_identities_load_file(self):
        """ Check the local loading of identities files """
        setup_http_server()

        config = Config(CONF_FILE)
        task = TaskIdentitiesLoad(config)
        task.execute()
        # Check the number of identities loaded from local and remote files
        nuids = len(api.unique_identities(self.sh_db))
        self.assertEqual(nuids, 4)
开发者ID:zhquan,项目名称:mordred,代码行数:10,代码来源:test_task_identities.py


示例11: test_unify_email_name_matcher_with_blacklist

    def test_unify_email_name_matcher_with_blacklist(self):
        """Test unify method using a blacklist"""

        # Add some entries to the blacklist
        api.add_to_matching_blacklist(self.db, 'Jane Rae Doe')
        api.add_to_matching_blacklist(self.db, '[email protected]')

        before = api.unique_identities(self.db)
        self.assertEqual(len(before), 6)

        code = self.cmd.unify(matching='email-name')
        self.assertEqual(code, CMD_SUCCESS)

        after = api.unique_identities(self.db)
        self.assertEqual(len(after), 5)

        # Only two identities were merged due to the blacklist
        jsmith = after[2]
        self.assertEqual(jsmith.uuid, '75d95d6c8492fd36d24a18bd45d62161e05fbc97')
        self.assertEqual(len(jsmith.identities), 6)
开发者ID:geekygirldawn,项目名称:sortinghat,代码行数:20,代码来源:test_cmd_unify.py


示例12: test_create_profile_from_identities

    def test_create_profile_from_identities(self):
        """Check whether a profile is created using the data identities"""

        parser = self.get_parser(datadir('sortinghat_identities_profiles.json'))

        code = self.cmd.import_identities(parser)
        self.assertEqual(code, CMD_SUCCESS)

        # Check the contents of the registry
        uids = api.unique_identities(self.db)
        self.assertEqual(len(uids), 3)

        # Jane Rae
        uid = uids[0]
        self.assertEqual(uid.uuid, '17ab00ed3825ec2f50483e33c88df223264182ba')

        prf = uid.profile
        self.assertEqual(prf.uuid, '17ab00ed3825ec2f50483e33c88df223264182ba')
        self.assertEqual(prf.name, 'Jane Roe')
        self.assertEqual(prf.email, '[email protected]')
        self.assertEqual(prf.gender, None)
        self.assertEqual(prf.gender_acc, None)
        self.assertEqual(prf.is_bot, False)
        self.assertEqual(prf.country_code, None)
        self.assertEqual(prf.country, None)

        # John Smith
        uid = uids[1]
        self.assertEqual(uid.uuid, 'a9b403e150dd4af8953a52a4bb841051e4b705d9')

        prf = uid.profile
        self.assertEqual(prf.uuid, 'a9b403e150dd4af8953a52a4bb841051e4b705d9')
        self.assertEqual(prf.name, 'John Smith')
        self.assertEqual(prf.email, '[email protected]')
        self.assertEqual(prf.gender, None)
        self.assertEqual(prf.gender_acc, None)
        self.assertEqual(prf.is_bot, False)
        self.assertEqual(prf.country_code, None)
        self.assertEqual(prf.country, None)

        # John Doe
        uid = uids[2]
        self.assertEqual(uid.uuid, 'c2f8c3d7b49cdbfb0af9fc9db2ca098ec6c06c2f')

        prf = uid.profile
        self.assertEqual(prf.uuid, 'c2f8c3d7b49cdbfb0af9fc9db2ca098ec6c06c2f')
        self.assertEqual(prf.name, 'jdoe')
        self.assertEqual(prf.email, '[email protected]')
        self.assertEqual(prf.gender, None)
        self.assertEqual(prf.gender_acc, None)
        self.assertEqual(prf.is_bot, False)
        self.assertEqual(prf.country_code, None)
        self.assertEqual(prf.country, None)
开发者ID:acs,项目名称:sortinghat,代码行数:53,代码来源:test_cmd_load.py


示例13: test_unify_success_no_recovery_mode

    def test_unify_success_no_recovery_mode(self):
        """Test unify method when the recovery file exists but the recovery mode is not active"""

        original_log = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data/unify_matches.log')
        shutil.copyfile(original_log, self.recovery_path)

        with unittest.mock.patch('sortinghat.cmd.unify.RecoveryFile.location') as mock_location:
            mock_location.return_value = self.recovery_path

            before = api.unique_identities(self.db)
            self.assertEqual(len(before), 6)

            self.assertTrue(os.path.exists(self.recovery_path))
            code = self.cmd.unify(matching='default')
            self.assertEqual(code, CMD_SUCCESS)

            after = api.unique_identities(self.db)
            self.assertEqual(len(after), 5)

            # jsmith identities with same email address
            jsmith = after[0]
            self.assertEqual(jsmith.uuid, '178315df7941fc76a6ffb06fd5b00f6932ad9c41')

            identities = jsmith.identities
            identities.sort(key=lambda x: x.id)

            self.assertEqual(len(identities), 7)

            id_ = identities[1]
            self.assertEqual(id_.email, '[email protected]')
            self.assertEqual(id_.source, 'mls')

            id_ = identities[3]
            self.assertEqual(id_.email, '[email protected]')
            self.assertEqual(id_.source, 'scm')

            output = sys.stdout.getvalue().strip()
            self.assertEqual(output, UNIFY_DEFAULT_OUTPUT)
            self.assertTrue(os.path.exists(self.recovery_path))
开发者ID:MetricsGrimoire,项目名称:sortinghat,代码行数:39,代码来源:test_cmd_unify.py


示例14: test_autogender

        def test_autogender(self):
            """Test whether autogender SH command is executed"""

            config = Config(CONF_FILE)
            # Test default value
            self.assertEqual(config.get_conf()['sortinghat']['gender'], False)
            config.get_conf()['sortinghat']['gender'] = True

            # Load some identities
            task = TaskIdentitiesLoad(config)
            task.execute()
            # Check the number of identities loaded from local and remote files
            uids = api.unique_identities(self.sh_db)

            task = TaskIdentitiesMerge(config)
            self.assertEqual(task.do_autogender(), None)

            uids = api.unique_identities(self.sh_db)

            found_genders = [uid.profile.gender for uid in uids]
            expected_genders = ['male', 'female', 'male', 'male']

            self.assertEqual(found_genders, expected_genders)
开发者ID:zhquan,项目名称:mordred,代码行数:23,代码来源:test_task_identities.py


示例15: test_load

    def test_load(self):
        """Test to load identities and organizations from a file"""

        code = self.cmd.run(datadir('sortinghat_valid.json'), '--verbose')
        self.assertEqual(code, CMD_SUCCESS)

        uids = api.unique_identities(self.db)
        self.assertEqual(len(uids), 2)

        orgs = api.registry(self.db)
        self.assertEqual(len(orgs), 3)

        output = sys.stdout.getvalue().strip()
        self.assertEqual(output, LOAD_OUTPUT)
开发者ID:acs,项目名称:sortinghat,代码行数:14,代码来源:test_cmd_load.py


示例16: test_unify_email_name_matcher_with_blacklist

    def test_unify_email_name_matcher_with_blacklist(self):
        """Test unify method using a blacklist"""

        # Add some entries to the blacklist
        api.add_to_matching_blacklist(self.db, 'Jane Rae Doe')
        api.add_to_matching_blacklist(self.db, '[email protected]')

        before = api.unique_identities(self.db)
        self.assertEqual(len(before), 6)

        code = self.cmd.unify(matching='email-name')
        self.assertEqual(code, CMD_SUCCESS)

        after = api.unique_identities(self.db)
        self.assertEqual(len(after), 5)

        # Only two identities were merged due to the blacklist
        jsmith = after[0]
        self.assertEqual(jsmith.uuid, '178315df7941fc76a6ffb06fd5b00f6932ad9c41')
        self.assertEqual(len(jsmith.identities), 4)

        jsmith = after[1]
        self.assertEqual(jsmith.uuid, '400fdfaab5918d1b7e0e0efba4797abdc378bd7d')
        self.assertEqual(len(jsmith.identities), 6)
开发者ID:MetricsGrimoire,项目名称:sortinghat,代码行数:24,代码来源:test_cmd_unify.py


示例17: test_create_profile_from_identities

    def test_create_profile_from_identities(self):
        """Check whether a profile is created using the data identities"""

        parser = self.get_parser('data/sortinghat_identities_profiles.json')

        code = self.cmd.import_identities(parser)
        self.assertEqual(code, CMD_SUCCESS)

        # Check the contents of the registry
        uids = api.unique_identities(self.db)
        self.assertEqual(len(uids), 3)

        # John Smith
        uid = uids[0]
        self.assertEqual(uid.uuid, '03e12d00e37fd45593c49a5a5a1652deca4cf302')

        prf = uid.profile
        self.assertEqual(prf.uuid, '03e12d00e37fd45593c49a5a5a1652deca4cf302')
        self.assertEqual(prf.name, 'John Smith')
        self.assertEqual(prf.email, '[email protected]')
        self.assertEqual(prf.is_bot, False)
        self.assertEqual(prf.country_code, None)
        self.assertEqual(prf.country, None)

        # John Doe
        uid = uids[1]
        self.assertEqual(uid.uuid, '3c3c71c67952135eb92a9cace538ffbe6cb39d88')

        prf = uid.profile
        self.assertEqual(prf.uuid, '3c3c71c67952135eb92a9cace538ffbe6cb39d88')
        self.assertEqual(prf.name, 'jdoe')
        self.assertEqual(prf.email, '[email protected]')
        self.assertEqual(prf.is_bot, False)
        self.assertEqual(prf.country_code, None)
        self.assertEqual(prf.country, None)

        # Jane Rae
        uid = uids[2]
        self.assertEqual(uid.uuid, '52e0aa0a14826627e633fd15332988686b730ab3')

        prf = uid.profile
        self.assertEqual(prf.uuid, '52e0aa0a14826627e633fd15332988686b730ab3')
        self.assertEqual(prf.name, 'Jane Roe')
        self.assertEqual(prf.email, '[email protected]')
        self.assertEqual(prf.is_bot, False)
        self.assertEqual(prf.country_code, None)
        self.assertEqual(prf.country, None)
开发者ID:geekygirldawn,项目名称:sortinghat,代码行数:47,代码来源:test_cmd_load.py


示例18: test_autogender

    def test_autogender(self):
        """Test autogender method"""

        http_requests = setup_genderize_server()

        self.cmd.autogender(api_token='abcdefghi')

        uids = api.unique_identities(self.db)

        prf = uids[0].profile
        self.assertEqual(prf.uuid, '2a9ec221b8dd5d5a85ae0e3276b8b2c3618ee15e')
        self.assertEqual(prf.gender, 'female')
        self.assertEqual(prf.gender_acc, 100)

        # Jane Rae gender is not updated because it was already set
        prf = uids[1].profile
        self.assertEqual(prf.uuid, '3e1eccdb1e52ea56225f419d3e532fe9133c7821')
        self.assertEqual(prf.gender, 'unknown')
        self.assertEqual(prf.gender_acc, 100)

        prf = uids[2].profile
        self.assertEqual(prf.uuid, '539acca35c2e8502951a97d2d5af8b0857440b50')
        self.assertEqual(prf.gender, 'male')
        self.assertEqual(prf.gender_acc, 99)

        prf = uids[3].profile
        self.assertEqual(prf.uuid, 'a39ac334be9f17bfc7f9f21bbb25f389388f8e18')
        self.assertEqual(prf.gender, 'male')
        self.assertEqual(prf.gender_acc, 99)

        # Check requests
        expected = [
            {
                'name': ['jane'],
                'apikey': ['abcdefghi']
            },
            {
                'name': ['john'],
                'apikey': ['abcdefghi']
            },
        ]

        self.assertEqual(len(http_requests), len(expected))

        for i in range(len(expected)):
            self.assertDictEqual(http_requests[i].querystring, expected[i])
开发者ID:MetricsGrimoire,项目名称:sortinghat,代码行数:46,代码来源:test_cmd_autogender.py


示例19: test_matching_no_strict

    def test_matching_no_strict(self):
        """Check if identities with no strict matching are merged"""

        # First, insert the identity that will match with one
        # from the file
        api.add_identity(self.db, 'unknown', email='[email protected]')

        parser = self.get_parser(datadir('sortinghat_no_strict_valid.json'))

        code = self.cmd.import_identities(parser, matching='default',
                                          no_strict_matching=True)
        self.assertEqual(code, CMD_SUCCESS)

        # Check whether identities were merged
        uids = api.unique_identities(self.db)
        self.assertEqual(len(uids), 1)
        self.assertEqual(len(uids[0].identities), 2)
开发者ID:acs,项目名称:sortinghat,代码行数:17,代码来源:test_cmd_load.py


示例20: test_load_organizations

    def test_load_organizations(self):
        """Test to load organizations from a file"""

        code = self.cmd.run('--orgs', datadir('sortinghat_orgs_valid.json'))
        self.assertEqual(code, CMD_SUCCESS)

        uids = api.unique_identities(self.db)
        self.assertEqual(len(uids), 0)

        orgs = api.registry(self.db)
        self.assertEqual(len(orgs), 3)

        output = sys.stdout.getvalue().strip()
        self.assertEqual(output, LOAD_SH_ORGS_OUTPUT)

        output = sys.stderr.getvalue().strip()
        self.assertEqual(output, LOAD_ORGS_OUTPUT_WARNING)
开发者ID:acs,项目名称:sortinghat,代码行数:17,代码来源:test_cmd_load.py



注:本文中的sortinghat.api.unique_identities函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sos._函数代码示例发布时间:2022-05-27
下一篇:
Python sortedsets.set函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap