This repository has been archived by the owner on Mar 15, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Blocklist: allow mulitple apps per plugin (bug 795387)
- Loading branch information
Showing
10 changed files
with
176 additions
and
41 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
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
Empty file.
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,33 @@ | ||
from amo.tests import TestCase | ||
from blocklist import forms | ||
from blocklist.models import BlocklistItem, BlocklistPlugin | ||
|
||
|
||
class BlocklistFormTest(TestCase): | ||
|
||
def setUp(self): | ||
super(BlocklistFormTest, self).setUp() | ||
self.blitem = BlocklistItem.objects.create() | ||
self.blplugin = BlocklistPlugin.objects.create() | ||
|
||
def test_app_form_only_blitem(self): | ||
data = {'blitem': self.blitem.pk, 'blplugin': None} | ||
form = forms.BlocklistAppForm(data) | ||
assert form.is_valid() | ||
|
||
def test_app_form_only_blplugin(self): | ||
data = {'blplugin': self.blplugin.pk, 'blitem': None} | ||
form = forms.BlocklistAppForm(data) | ||
assert form.is_valid() | ||
|
||
def test_app_form_neither_blplugin_and_blitem(self): | ||
data = {'blitem': None, 'blplugin': None} | ||
form = forms.BlocklistAppForm(data) | ||
assert not form.is_valid() | ||
assert 'One and only one' in str(form.errors) | ||
|
||
def test_app_form_both_blplugin_and_blitem(self): | ||
data = {'blitem': self.blitem.pk, 'blplugin': self.blplugin.pk} | ||
form = forms.BlocklistAppForm(data) | ||
assert not form.is_valid() | ||
assert 'One and only one' in str(form.errors) |
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,5 @@ | ||
ALTER TABLE `blapps` ADD COLUMN `blplugin_id` int(11) unsigned DEFAULT NULL; | ||
|
||
ALTER TABLE `blapps` ADD CONSTRAINT `blplugin_id_apps` FOREIGN KEY (`blplugin_id`) REFERENCES `blplugins` (`id`); | ||
|
||
ALTER TABLE `blapps` MODIFY `blitem_id` int(11) unsigned DEFAULT NULL; |
Oops, something went wrong.