コード例 #1
0
ファイル: test_auth.py プロジェクト: soitun/commcare-hq
 def test_login_with_domain(self):
     self.assertAuthenticationSuccess(
         LoginAndDomainAuthentication(),
         self._get_request_with_api_key(domain=self.domain))
     self.assertAuthenticationSuccess(
         LoginAndDomainAuthentication(),
         self._get_request_with_api_key(domain=self.domain2))
コード例 #2
0
 class Meta(CustomResourceMeta):
     authentication = LoginAndDomainAuthentication(allow_session_auth=True)
     object_class = Application
     list_allowed_methods = ['get']
     detail_allowed_methods = ['get']
     resource_name = 'application'
     paginator_class = DoesNothingPaginatorCompat
コード例 #3
0
ファイル: test_auth.py プロジェクト: soitun/commcare-hq
 def test_login_with_wrong_domain(self):
     project = Domain.get_or_create_with_name('api-test-fail',
                                              is_active=True)
     self.addCleanup(project.delete)
     self.assertAuthenticationFail(
         LoginAndDomainAuthentication(),
         self._get_request_with_api_key(domain=project.name))
コード例 #4
0
ファイル: test_auth.py プロジェクト: soitun/commcare-hq
 def test_login_with_domain_key_wrong(self):
     self.assertAuthenticationFail(
         LoginAndDomainAuthentication(),
         self._get_request(
             self.domain2,
             HTTP_AUTHORIZATION=self._construct_api_auth_header(
                 self.username, self.domain_api_key)))
コード例 #5
0
ファイル: meta.py プロジェクト: taylordowns2000/commcare-hq
class CustomResourceMeta(object):
    authorization = ReadOnlyAuthorization()
    authentication = LoginAndDomainAuthentication()
    serializer = CustomXMLSerializer()
    default_format = 'application/json'
    throttle = HQThrottle(
        throttle_at=getattr(settings, 'CCHQ_API_THROTTLE_REQUESTS', 25),
        timeframe=getattr(settings, 'CCHQ_API_THROTTLE_TIMEFRAME', 15)
    )
コード例 #6
0
ファイル: v0_1.py プロジェクト: udaracamarasinghe/commcare-hq
 class Meta(LocationResource.Meta):
     authentication = LoginAndDomainAuthentication(allow_session_auth=True)
     resource_name = 'ils_location'
コード例 #7
0
ファイル: v0_1.py プロジェクト: sophiamcg/commcare-hq
 class Meta(CustomResourceMeta):
     authentication = LoginAndDomainAuthentication(allow_session_auth=True)
     object_class = SQLLocation
     resource_name = 'location_internal'
     limit = 0
コード例 #8
0
ファイル: v0_1.py プロジェクト: sophiamcg/commcare-hq
 class Meta(CustomResourceMeta):
     authentication = LoginAndDomainAuthentication()
     object_class = SQLLocation
     resource_name = 'location'
     limit = 0
     max_limit = 10000
コード例 #9
0
class CustomResourceMeta(object):
    authorization = ReadOnlyAuthorization()
    authentication = LoginAndDomainAuthentication()
    serializer = CustomXMLSerializer()
    default_format = 'application/json'
    throttle = get_hq_throttle()
コード例 #10
0
ファイル: v0_4.py プロジェクト: Mechachleopteryx/commcare-hq
 class Meta(CustomResourceMeta):
     authentication = LoginAndDomainAuthentication()
     object_class = Application
     list_allowed_methods = ['get']
     detail_allowed_methods = ['get']
     resource_name = 'application'
コード例 #11
0
ファイル: test_auth.py プロジェクト: soitun/commcare-hq
 def test_auth_type_basic_with_domain(self):
     self.assertAuthenticationSuccess(
         LoginAndDomainAuthentication(),
         self._get_request_with_basic_auth(domain=self.domain))
コード例 #12
0
ファイル: test_auth.py プロジェクト: soitun/commcare-hq
 def test_auth_type_basic_no_domain(self):
     self.assertAuthenticationFail(LoginAndDomainAuthentication(),
                                   self._get_request_with_basic_auth())
コード例 #13
0
ファイル: test_auth.py プロジェクト: soitun/commcare-hq
 def test_login_no_auth_with_domain(self):
     self.assertAuthenticationFail(LoginAndDomainAuthentication(),
                                   self._get_request(domain=self.domain))