Exemple #1
0
 def test_hello_project(self, hello_project):
     for group in hello_project:
         idol = IdolFactory()
         membership = MembershipFactory(idol=idol, group=group, started=datetime.date.today())
         idol.primary_membership = membership
         idol.save()
     assert len(Idol.objects.hello_project()) == 6
Exemple #2
0
def test_idols_and_single_groups(release):
    # When an idol is the subject object and there is a single participating
    # group, it should not render a result.
    subject = IdolFactory()
    primary_group = GroupFactory()
    subject.primary_membership = MembershipFactory(idol=subject, group=primary_group)
    release.participants = [primary_group]
    out = Template("{% load music_tags %}" "{% contextual_participants release=release context=object %}").render(
        Context({"release": release, "object": subject})
    )
    assert out.rstrip("\n") == ""
Exemple #3
0
def test_soloist(release):
    # When a soloist is the subject object, it should not render a result.
    subject = IdolFactory()
    group = GroupFactory(romanized_name="Soloist")
    membership = MembershipFactory(idol=subject, group=group)
    subject.primary_membership = membership
    release.participants = [subject]
    out = Template("{% load music_tags %}" "{% contextual_participants release=release context=object %}").render(
        Context({"release": release, "object": subject})
    )
    assert out.rstrip("\n") == ""
Exemple #4
0
def test_supergroup_with_idol_context(release):
    subject = IdolFactory()
    subject.primary_membership = MembershipFactory(idol=subject)
    subject.save()
    supergroup = GroupFactory(classification=CLASSIFICATIONS.supergroup)
    MembershipFactory(idol=subject, group=supergroup)
    release.participants = [supergroup]
    out = Template("{% load music_tags %}" "{% contextual_participants release=release context=object %}").render(
        Context({"release": release, "object": subject})
    )
    assert "for" in out
    assert len(BeautifulSoup(out).find_all("a")) == 1
Exemple #5
0
def test_idols_and_secondary_groups(release):
    # When an idol is the subject object and a participating group is not their
    # primary group, "for" should be rendered along with the group.
    subject = IdolFactory()
    primary_group = GroupFactory()
    subject.primary_membership = MembershipFactory(idol=subject, group=primary_group)
    secondary_group = GroupFactory()
    MembershipFactory(idol=subject, group=secondary_group)
    release.participants = [subject, secondary_group]
    out = Template("{% load music_tags %}" "{% contextual_participants release=release context=object %}").render(
        Context({"release": release, "object": subject})
    )
    assert "for" in out
    assert len(BeautifulSoup(out).find_all("a")) == 1