예제 #1
0
def test_cannot_get_by_name_if_does_not_exist():
    connect('*****@*****.**', 'token', name='foo')
    with assert_raises(MisconfiguredError):
        get('bar')

    with assert_raises(MisconfiguredError):
        get()
예제 #2
0
def test_cannot_get_by_name_if_does_not_exist():
    connect('*****@*****.**', 'token', name='foo')
    with assert_raises(MisconfiguredError):
        get('bar')

    with assert_raises(MisconfiguredError):
        get()
예제 #3
0
 def get(self, id=None, email=None):
     if id is not None:
         return super(PersonManager, self).get(id)
     elif email is not None:
         conn = connection.get(self.using)
         path = self.resource_cls.Meta.fetch_by_email_path
         resp = conn.post(conn.build_absolute_url(path),
                          json={'email': email})
         if resp.status_code not in {codes.ok}:
             raise ApiError(resp.status_code, resp.text)
         return self.resource_cls.from_api_data(resp.json())
     raise ProspyrException("id or email is required when getting a Person")
예제 #4
0
 def get(self, id=None, email=None):
     if id is not None:
         return super(PersonManager, self).get(id)
     elif email is not None:
         conn = connection.get(self.using)
         path = self.resource_cls.Meta.fetch_by_email_path
         resp = conn.post(
             conn.build_absolute_url(path),
             json={'email': email}
         )
         if resp.status_code not in {codes.ok}:
             raise ApiError(resp.status_code, resp.text)
         return self.resource_cls.from_api_data(resp.json())
     raise ProspyrException("id or email is required when getting a Person")
예제 #5
0
 def _get_conn(self, using):
     return connection.get(using)
예제 #6
0
def test_can_get_by_name():
    connect('*****@*****.**', 'token', name='foo')
    get('foo')
예제 #7
0
 def _conn(self):
     return connection.get(self._using)
예제 #8
0
 def _get_conn(self, using):
     return connection.get(using)
예제 #9
0
def test_can_get_by_name():
    connect('*****@*****.**', 'token', name='foo')
    get('foo')
예제 #10
0
 def _conn(self):
     return connection.get(self._using)