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()
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()
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")
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")
def _get_conn(self, using): return connection.get(using)
def test_can_get_by_name(): connect('*****@*****.**', 'token', name='foo') get('foo')
def _conn(self): return connection.get(self._using)
def _get_conn(self, using): return connection.get(using)
def test_can_get_by_name(): connect('*****@*****.**', 'token', name='foo') get('foo')
def _conn(self): return connection.get(self._using)