示例#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)