8000 Merge pull request #607 from bboe/json_encoding · pythonthings/github3.py@bc3245e · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit bc3245e

Browse files
authored
Merge pull request sigmavirus24#607 from bboe/json_encoding
Fix serialization on Event objects.
2 parents 16acb4b + 83f4e2d commit bc3245e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

github3/events.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"""
99
from __future__ import unicode_literals
1010

11+
import copy
12+
1113
from .models import GitHubCore
1214

1315

@@ -31,6 +33,10 @@ class Event(GitHubCore):
3133
"""
3234

3335
def _update_attributes(self, event):
36+
# If we don't copy this, then we end up altering _json_data which we do
37+
# not want to do:
38+
event = copy.deepcopy(event)
39+
3440
from .users import User
3541
from .orgs import Organization
3642
#: :class:`User <github3.users.User>` object representing the actor.

tests/integration/test_orgs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ def test_events(self):
117117

118118
for event in o.events():
119119
assert isinstance(event, github3.events.Event)
120+
assert isinstance(event.as_json(), str)
120121

121122
def test_members(self):
122123
"""Test the ability to retrieve an organization's members."""

0 commit comments

Comments
 (0)
0