コード例 #1
0
 def setUpClass(cls):
     cls.domain = Domain(name='foo')
     cls.domain.save()
     cls.user = CommCareUser.create(cls.domain.name, 'somebody', 'password')
     cls.user_id = cls.user._id
     cls.factory = CaseFactory(domain='foo', case_defaults={'owner_id': cls.user_id})
     ENABLE_LOADTEST_USERS.set('foo', True, namespace='domain')
コード例 #2
0
 def setUpClass(cls):
     cls.domain = Domain(name='foo')
     cls.domain.save()
     cls.user = CommCareUser.create(cls.domain.name, 'somebody', 'password')
     cls.user_id = cls.user._id
     cls.factory = CaseFactory(domain='foo', case_defaults={'owner_id': cls.user_id})
     ENABLE_LOADTEST_USERS.set('foo', True, namespace='domain')
コード例 #3
0
 def setUpClass(cls):
     super(LoadtestUserTest, cls).setUpClass()
     cls.domain = Domain(name='foo')
     cls.domain.save()
     cls.user = CommCareUser.create(cls.domain.name, 'somebody', 'password', None, None)
     cls.user_id = cls.user._id
     cls.factory = CaseFactory(domain='foo', case_defaults={'owner_id': cls.user_id})
     ENABLE_LOADTEST_USERS.set('foo', True, namespace=NAMESPACE_DOMAIN)
コード例 #4
0
def get_loadtest_factor_for_user(domain, user_id):
    from corehq.apps.users.models import CouchUser, CommCareUser
    if ENABLE_LOADTEST_USERS.enabled(domain) and user_id:
        user = CouchUser.get_by_user_id(user_id, domain=domain)
        if isinstance(user, CommCareUser):
            return user.loadtest_factor or 1
    return 1
コード例 #5
0
def get_loadtest_factor_for_user(domain, user_id):
    from corehq.apps.users.models import CouchUser, CommCareUser
    if ENABLE_LOADTEST_USERS.enabled(domain) and user_id:
        user = CouchUser.get_by_user_id(user_id, domain=domain)
        if isinstance(user, CommCareUser):
            return user.loadtest_factor or 1
    return 1
コード例 #6
0
ファイル: models.py プロジェクト: tstalka/commcare-hq
 def loadtest_factor(self):
     """
     Gets the loadtest factor for a domain and user. Is always 1 unless
     both the toggle is enabled for the domain, and the user has a non-zero,
     non-null factor set.
     """
     if ENABLE_LOADTEST_USERS.enabled(self.domain):
         return self._loadtest_factor or 1
     return 1
コード例 #7
0
ファイル: load_testing.py プロジェクト: ekush/commcare-hq
def get_loadtest_factor(domain, user):
    """
    Gets the loadtest factor for a domain and user. Is always 1 unless
    both the toggle is enabled for the domain, and the user has a non-zero,
    non-null factor set.
    """
    if domain and ENABLE_LOADTEST_USERS.enabled(domain):
        return getattr(user, 'loadtest_factor', 1) or 1
    return 1
コード例 #8
0
ファイル: load_testing.py プロジェクト: ansarbek/commcare-hq
def get_loadtest_factor(domain, user):
    """
    Gets the loadtest factor for a domain and user. Is always 1 unless
    both the toggle is enabled for the domain, and the user has a non-zero,
    non-null factor set.
    """
    if domain and ENABLE_LOADTEST_USERS.enabled(domain):
        return getattr(user, 'loadtest_factor', 1) or 1
    return 1
コード例 #9
0
 def setUp(self):
     delete_all_cases()
     self.assertTrue(ENABLE_LOADTEST_USERS.enabled('foo'))
コード例 #10
0
 def setUp(self):
     delete_all_cases()
     self.assertTrue(ENABLE_LOADTEST_USERS.enabled('foo'))