forked from mozilla/badges.mozilla.org
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue mozilla#108: List team memberships on profile page
- Loading branch information
Showing
4 changed files
with
79 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import logging | ||
|
||
import json | ||
from nose.tools import eq_, ok_ | ||
from django.test import TestCase | ||
from django.http import HttpRequest | ||
from django import test | ||
|
||
from django.contrib.auth.models import User | ||
|
||
from pyquery import PyQuery as pq | ||
from django_browserid.tests import mock_browserid | ||
|
||
from tower import activate | ||
|
||
from teamwork.models import Role | ||
|
||
from badger.models import Badge | ||
|
||
from badgus.base.urlresolvers import reverse | ||
from badgus.teams.models import BadgeTeam | ||
|
||
|
||
class BadgeProfileViewsTest(test.TestCase): | ||
|
||
def test_list_team_membership(self): | ||
"""User profile page should list team memberships""" | ||
team = BadgeTeam(name='randoteam23') | ||
team.save() | ||
|
||
team.members.through.objects.all().delete() | ||
|
||
member = User(username='rando23', email='[email protected]') | ||
member.save() | ||
|
||
url = member.get_absolute_url() | ||
|
||
r = self.client.get(url, follow=True) | ||
doc = pq(r.content) | ||
eq_(0, doc.find('.teams .team .label .title:contains("randoteam23")').length) | ||
|
||
team.add_member(member) | ||
|
||
r = self.client.get(url, follow=True) | ||
doc = pq(r.content) | ||
eq_(1, doc.find('.teams .team .label .title:contains("randoteam23")').length) |
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