-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Unit model. Team pages is now handled with django-cms.
- Loading branch information
Showing
7 changed files
with
28 additions
and
233 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
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
27 changes: 27 additions & 0 deletions
27
foundation/organisation/migrations/0024_remove_unitmembership_person_and_more.py
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,27 @@ | ||
# Generated by Django 4.2.3 on 2024-06-11 07:59 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('organisation', '0023_sidebarextension_image'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='unitmembership', | ||
name='person', | ||
), | ||
migrations.RemoveField( | ||
model_name='unitmembership', | ||
name='unit', | ||
), | ||
migrations.DeleteModel( | ||
name='Unit', | ||
), | ||
migrations.DeleteModel( | ||
name='UnitMembership', | ||
), | ||
] |
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 |
---|---|---|
|
@@ -11,170 +11,13 @@ | |
from ..models import ( | ||
Board, | ||
Person, | ||
Unit, | ||
NetworkGroup, | ||
NetworkGroupMembership, | ||
BoardMembership, | ||
UnitMembership, | ||
NowDoing, | ||
) | ||
|
||
|
||
class UnitListViewTest(WebTest): | ||
def setUp(self): | ||
self.donatello = Person.objects.create( | ||
name="Donatello (Donnie)", | ||
description="Turtle with a purple mask", | ||
email="[email protected]", | ||
) | ||
self.leonardo = Person.objects.create( | ||
name="Leonardo (Leo)", | ||
description="Turtle with a blue mask", | ||
email="[email protected]", | ||
) | ||
self.raphael = Person.objects.create( | ||
name="Raphael (Raph)", | ||
description="Turtle with a red mask", | ||
email="[email protected]", | ||
twitter="raph", | ||
url="http://tmnt.org/raphael", | ||
) | ||
self.rocksteady = Person.objects.create( | ||
name="Rocksteady", | ||
description="Mutant rhinoceros", | ||
email="[email protected]", | ||
twitter="rocksteady", | ||
url="http://beboprocksteady.com", | ||
) | ||
self.april = Person.objects.create( | ||
name="April O'Neil", | ||
description="Computer Programmer", | ||
email="[email protected]", | ||
twitter="april", | ||
url="http://oneil.me", | ||
) | ||
self.splinter = Person.objects.create( | ||
name="Splinter", description="Ninja rat", email="[email protected]" | ||
) | ||
|
||
self.turtles = Unit.objects.create(name="Turtles") | ||
self.footclan = Unit.objects.create(name="Foot Clan") | ||
self.masters = Unit.objects.create(name="Ninja Masters", order=1) | ||
|
||
self.turtle_donatello = UnitMembership.objects.create( | ||
title="Hacker", person=self.donatello, unit=self.turtles | ||
) | ||
|
||
self.turtle_leonardo = UnitMembership.objects.create( | ||
title="Leader", person=self.leonardo, unit=self.turtles, order=1 | ||
) | ||
|
||
self.turtle_raphael = UnitMembership.objects.create( | ||
title="Bad boy", person=self.raphael, unit=self.turtles | ||
) | ||
|
||
self.evil_rocksteady = UnitMembership.objects.create( | ||
title="Comic relief", person=self.rocksteady, unit=self.footclan | ||
) | ||
|
||
self.master_splinter = UnitMembership.objects.create( | ||
title="Master", person=self.splinter, unit=self.masters | ||
) | ||
|
||
def test_units_in_response(self): | ||
response = self.app.get(reverse("units")) | ||
self.assertTrue(self.turtles.name in response) | ||
self.assertTrue(self.footclan.name in response) | ||
|
||
def test_unit_member_in_response(self): | ||
response = self.app.get(reverse("units")) | ||
self.assertTrue(self.leonardo.name in response) | ||
self.assertTrue(self.raphael.name in response) | ||
self.assertTrue(self.rocksteady.name in response) | ||
|
||
def test_non_unit_member_not_in_response(self): | ||
response = self.app.get(reverse("units")) | ||
self.assertTrue(self.april.name not in response) | ||
|
||
def test_unit_members_in_units(self): | ||
response = self.app.get(reverse("units")) | ||
|
||
# Units are ordered alphabetically | ||
footclan = response.text.find(self.footclan.name) | ||
turtles = response.text.find(self.turtles.name) | ||
self.assertTrue(footclan < turtles) | ||
|
||
# Unit members are ordered alphabetically | ||
# unless order is overwritten | ||
donatello = response.text.find(self.donatello.name) | ||
leonardo = response.text.find(self.leonardo.name) | ||
raphael = response.text.find(self.raphael.name) | ||
rocksteady = response.text.find(self.rocksteady.name) | ||
self.assertTrue(footclan < rocksteady < turtles) | ||
self.assertTrue(turtles < leonardo < donatello < raphael) | ||
|
||
def test_description_in_response(self): | ||
response = self.app.get(reverse("units")) | ||
self.assertTrue(self.leonardo.description in response) | ||
self.assertTrue(self.raphael.description in response) | ||
self.assertTrue(self.rocksteady.description in response) | ||
self.assertTrue(self.april.description not in response) | ||
|
||
def test_email_in_response(self): | ||
response = self.app.get(reverse("units")) | ||
self.assertTrue(self.leonardo.email in response) | ||
self.assertTrue(self.raphael.email in response) | ||
self.assertTrue(self.rocksteady.email in response) | ||
self.assertTrue(self.april.email not in response) | ||
|
||
def test_twitter_in_response(self): | ||
response = self.app.get(reverse("units")) | ||
twitter_url = "https://twitter.com/{handle}" | ||
twitter_raphael = twitter_url.format(handle=self.raphael.twitter) | ||
twitter_rocksteady = twitter_url.format(handle=self.rocksteady.twitter) | ||
twitter_april = twitter_url.format(handle=self.april.twitter) | ||
self.assertTrue(twitter_raphael in response) | ||
self.assertTrue(twitter_rocksteady in response) | ||
self.assertTrue(twitter_april not in response) | ||
|
||
# Raphael is the last turtle. We assume that the unit list will be | ||
# where the first occurance of the names come up (since main content | ||
# should come before sidebars). | ||
# Leonardo doesn't use Twitter so there shouldn't be a twitter url | ||
# between the last Leo's name and Raph's name | ||
leonardo = response.text.find(self.leonardo.name) | ||
raphael = response.text.find(self.raphael.name) | ||
twitter = response.text.find("https://twitter.com/", leonardo, raphael) | ||
self.assertTrue(twitter == -1) | ||
|
||
@skip("Broken after the 2019 update") | ||
def test_url_in_response(self): | ||
response = self.app.get(reverse("units")) | ||
|
||
self.assertTrue(self.raphael.url in response) | ||
self.assertTrue(self.rocksteady.url in response) | ||
self.assertTrue(self.april.url not in response) | ||
|
||
# Raphael is the last turtle. We assume that the unit list will be | ||
# where the first occurance of the names come up (since main content | ||
# should come before sidebars). | ||
# Leonardo doesn't have a website so there shouldn't be a | ||
# 'Personal website' between the last Leo's name and Raph's name | ||
|
||
leonardo = response.text.find(self.leonardo.name) | ||
raphael = response.text.find(self.raphael.name) | ||
website = response.text.find("Personal website", leonardo, raphael) | ||
self.assertTrue(website == -1) | ||
|
||
def test_manual_order_of_units(self): | ||
response = self.app.get(reverse("units")) | ||
masters = response.text.find(self.masters.name) | ||
turtles = response.text.find(self.turtles.name) | ||
footclan = response.text.find(self.footclan.name) | ||
|
||
self.assertTrue(masters < footclan < turtles) | ||
|
||
|
||
class BoardViewTest(WebTest): | ||
def setUp(self): | ||
self.leonardo = Person.objects.create( | ||
|
This file was deleted.
Oops, something went wrong.
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