forked from mozilla/zamboni
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
give webapps a separate slug namespace (bug 673581)
- Loading branch information
Jeff Balogh
committed
Jul 29, 2011
1 parent
2183b4b
commit 770de07
Showing
5 changed files
with
63 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import test_utils | ||
from nose.tools import eq_ | ||
|
||
import amo | ||
from addons.models import Addon, BlacklistedSlug | ||
from webapps.models import Webapp | ||
|
||
|
||
class TestWebapp(test_utils.TestCase): | ||
|
||
def test_webapp_type(self): | ||
webapp = Webapp() | ||
webapp.save() | ||
eq_(webapp.type, amo.ADDON_WEBAPP) | ||
|
||
def test_app_slugs_separate_from_addon_slugs(self): | ||
addon = Addon.objects.create(type=1, slug='slug') | ||
webapp = Webapp(app_slug='slug') | ||
webapp.save() | ||
eq_(webapp.slug, 'app-%s' % webapp.id) | ||
eq_(webapp.app_slug, 'slug') | ||
|
||
def test_app_slug_collision(self): | ||
Webapp(app_slug='slug').save() | ||
w2 = Webapp(app_slug='slug') | ||
w2.save() | ||
eq_(w2.app_slug, 'slug-1') | ||
|
||
def test_app_slug_blocklist(self): | ||
BlacklistedSlug.objects.create(name='slug') | ||
w = Webapp(app_slug='slug') | ||
w.save() | ||
eq_(w.app_slug, 'slug~') |
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,3 @@ | ||
ALTER TABLE addons | ||
ADD COLUMN `app_slug` varchar(30) default NULL, | ||
ADD CONSTRAINT UNIQUE KEY `app_slug` (`app_slug`); |