-
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.
Merge pull request #1099 from okfn/develop
[PROD] Clean old Board/Advisory models
- Loading branch information
Showing
9 changed files
with
31 additions
and
216 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/0025_remove_boardmembership_board_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 08:43 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('organisation', '0024_remove_unitmembership_person_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='boardmembership', | ||
name='board', | ||
), | ||
migrations.RemoveField( | ||
model_name='boardmembership', | ||
name='person', | ||
), | ||
migrations.DeleteModel( | ||
name='Board', | ||
), | ||
migrations.DeleteModel( | ||
name='BoardMembership', | ||
), | ||
] |
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 |
---|---|---|
@@ -1,126 +1,19 @@ | ||
from io import StringIO | ||
|
||
from django.urls import reverse | ||
from django.utils.html import escape | ||
from django_webtest import WebTest | ||
from unittest import skip | ||
|
||
from iso3166 import countries | ||
import csv | ||
|
||
from ..models import ( | ||
Board, | ||
Person, | ||
NetworkGroup, | ||
NetworkGroupMembership, | ||
BoardMembership, | ||
NowDoing, | ||
) | ||
|
||
|
||
class BoardViewTest(WebTest): | ||
def setUp(self): | ||
self.leonardo = Person.objects.create( | ||
name="Leonardo (Leo)", | ||
description="Turtle with a blue mask", | ||
email="[email protected]", | ||
) | ||
self.april = Person.objects.create( | ||
name="April O'Neil", | ||
description="Computer Programmer", | ||
email="[email protected]", | ||
twitter="april", | ||
url="http://oneil.me", | ||
) | ||
self.casey = Person.objects.create( | ||
name="Casey Jones", | ||
description="Hockey mask wearing vigilante", | ||
email="[email protected]", | ||
twitter="arnold", | ||
) | ||
self.splinter = Person.objects.create( | ||
name="Splinter", description="Ninja rat", email="[email protected]" | ||
) | ||
|
||
self.board = Board.objects.create( | ||
name="Board of directors", | ||
slug="board", | ||
description="The board consists of a rat", | ||
) | ||
self.council = Board.objects.create( | ||
name="Advisory Council", | ||
slug="advisory-board", | ||
description="Get a room you two!", | ||
) | ||
|
||
self.rat_board = BoardMembership.objects.create( | ||
title="Director", person=self.splinter, board=self.board | ||
) | ||
|
||
self.april_council = BoardMembership.objects.create( | ||
title="Technical consultant", person=self.april, board=self.council, order=2 | ||
) | ||
self.casey_council = BoardMembership.objects.create( | ||
title="Sport utilities consultant", | ||
person=self.casey, | ||
board=self.council, | ||
order=1, | ||
) | ||
self.leonardo_council = BoardMembership.objects.create( | ||
title="Medical consultant", | ||
person=self.leonardo, | ||
board=self.council, | ||
order=3, | ||
) | ||
|
||
@skip("Broken after the 2019 update") | ||
def test_board(self): | ||
response = self.app.get(reverse("board")) | ||
self.assertTrue(self.board.name in response.text) | ||
self.assertTrue(self.board.description in response.text) | ||
|
||
self.assertTrue(self.council.name not in response.text) | ||
|
||
self.assertTrue(self.splinter.name in response.text) | ||
self.assertTrue(self.rat_board.title in response.text) | ||
self.assertTrue(self.splinter.description in response.text) | ||
self.assertTrue(self.splinter.email not in response.text) | ||
|
||
self.assertTrue(self.casey.name not in response.text) | ||
self.assertTrue(self.april.name not in response.text) | ||
|
||
@skip("Broken after the 2019 update") | ||
def test_advisory_council(self): | ||
response = self.app.get(reverse("advisory-board")) | ||
self.assertTrue(self.council.name in response.text) | ||
self.assertTrue(self.council.description in response.text) | ||
|
||
self.assertTrue(self.board.name not in response.text) | ||
|
||
# April's name must be escaped because of the single quote in O'Neil | ||
self.assertTrue(escape(self.april.name) in response.text) | ||
self.assertTrue(self.april_council.title in response.text) | ||
self.assertTrue(self.april.description in response.text) | ||
self.assertTrue(self.april.email not in response.text) | ||
self.assertTrue(self.april.twitter in response.text) | ||
self.assertTrue(self.april.url in response.text) | ||
|
||
self.assertTrue(self.casey.name in response.text) | ||
self.assertTrue(self.casey_council.title in response.text) | ||
self.assertTrue(self.casey.description in response.text) | ||
self.assertTrue(self.casey.email not in response.text) | ||
self.assertTrue(self.casey.twitter in response.text) | ||
|
||
self.assertTrue(self.splinter.name not in response.text) | ||
|
||
def test_manual_order_of_units(self): | ||
response = self.app.get(reverse("advisory-board")) | ||
april = response.text.find(escape(self.april.name)) | ||
leonardo = response.text.find(self.leonardo.name) | ||
casey = response.text.find(self.casey.name) | ||
self.assertTrue(leonardo < april < casey) | ||
|
||
|
||
class NetworkGroupDetailViewTest(WebTest): | ||
def setUp(self): | ||
self.otto = Person.objects.create( | ||
|
This file was deleted.
Oops, something went wrong.
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
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