-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
send fedoramessaging objects in notificagtions_callbacks
Signed-off-by: Ryan Lerch <[email protected]>
- Loading branch information
Showing
4 changed files
with
59 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ SQLAlchemy >=0.7.2 | |
zope.sqlalchemy | ||
alembic | ||
arrow | ||
fedora_messaging | ||
tahrir-messages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,6 @@ def check_output(cmd): | |
except: | ||
return None | ||
|
||
|
||
except: | ||
import subprocess | ||
|
||
|
@@ -119,6 +118,12 @@ def test_last_login(self): | |
self.api.note_login(nickname=person.nickname) | ||
assert person.last_login | ||
|
||
assert len(self.callback_calls) == 1 | ||
message = self.callback_calls[0][0][0] | ||
assert message.body == {"user": {"username": "test", "badges_user_id": 1}} | ||
assert message.agent_name == "test" | ||
assert message.summary == "test logged into badges for the first time" | ||
|
||
def test_add_assertion(self): | ||
issuer_id = self.api.add_issuer( | ||
"TestOrigin", "TestName", "TestOrg", "TestContact" | ||
|
@@ -145,8 +150,36 @@ def test_add_assertion(self): | |
# Ensure that we would have published two fedmsg messages for that. | ||
assert len(self.callback_calls) == 2 | ||
|
||
# Ensure that the first message had a 'badge_id' in the message. | ||
assert "badge_id" in self.callback_calls[0][1]["msg"]["badge"] | ||
award_message = self.callback_calls[0][0][0] | ||
rank_advance_message = self.callback_calls[1][0][0] | ||
|
||
assert award_message.body == { | ||
"badge": { | ||
"name": "TestBadge", | ||
"description": "A test badge for doing unit tests", | ||
"image_url": "TestImage", | ||
"badge_id": "testbadge", | ||
}, | ||
"user": {"username": "test", "badges_user_id": 1}, | ||
} | ||
assert award_message.agent_name == "test" | ||
assert award_message.summary == "test was awarded the badge `TestBadge`" | ||
|
||
assert rank_advance_message.body == { | ||
"person": { | ||
"email": "[email protected]", | ||
"id": 1, | ||
"nickname": "test", | ||
"website": None, | ||
"bio": None, | ||
"rank": 1, | ||
}, | ||
"old_rank": None, | ||
} | ||
assert rank_advance_message.agent_name == "test" | ||
assert ( | ||
rank_advance_message.summary == "test's Badges rank changed from None to 1" | ||
) | ||
|
||
def test_get_badges_from_tags(self): | ||
issuer_id = self.api.add_issuer( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters