Skip to content
This repository has been archived by the owner on May 12, 2020. It is now read-only.

Commit

Permalink
Merge 1096bc5 into 5328c26
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikOssipoff committed Jun 10, 2015
2 parents 5328c26 + 1096bc5 commit 57f7161
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions paypalrestsdk/resource.py
Expand Up @@ -50,6 +50,9 @@ def __setattr__(self, name, value):
except AttributeError:
self.__data__[name] = self.convert(name, value)

def __contains__(self, item):
return item in self.__data__

def success(self):
return self.error is None

Expand Down
8 changes: 8 additions & 0 deletions test/unit_tests/resource_test.py
Expand Up @@ -139,3 +139,11 @@ class TestResource(Find, List, Post):
self.assertEqual(list_.api, default)

api.__api__ = original # Restore original api object

def test_contains(self):
data = {
'name': 'testing'
}
resource = Resource(data)
self.assertEqual('name' in resource, True)
self.assertEqual('testing' in resource, False)

0 comments on commit 57f7161

Please sign in to comment.