This commit is contained in:
Michael Kelly 2016-03-02 13:35:46 -08:00
Родитель 5f3edf28fd
Коммит bc8b2aa446
4 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -92,6 +92,8 @@ Running Normandy
docker run -it --env-file=.env mozilla/normandy:latest ./manage.py migrate docker run -it --env-file=.env mozilla/normandy:latest ./manage.py migrate
# Create a super user # Create a super user
docker run -t --env-file=.env mozilla/normandy:latest ./manage.py createsuperuser docker run -t --env-file=.env mozilla/normandy:latest ./manage.py createsuperuser
# Load inital database data
docker run -t --env-file=.env mozilla/normandy:latest ./manage.py initial_data
# Run the web server # Run the web server
docker run -t -p 8000:8000 --env-file=.env mozilla/normandy:latest docker run -t -p 8000:8000 --env-file=.env mozilla/normandy:latest

Просмотреть файл

@ -13,6 +13,7 @@ def classifier_preview(request):
client = form.save() client = form.save()
bundle = Bundle.for_client(client, exclude=[match_sample_rate]) bundle = Bundle.for_client(client, exclude=[match_sample_rate])
else: else:
client = None
bundle = None bundle = None
ctx = admin_site.each_context(request) ctx = admin_site.each_context(request)

Просмотреть файл

@ -10,6 +10,10 @@ from normandy.recipes.tests import (
@pytest.mark.django_db @pytest.mark.django_db
class TestClientClassifier(object): class TestClientClassifier(object):
def test_classify_initial(self, admin_client):
response = admin_client.get('/admin/classifier_preview')
assert response.status_code == 200
def test_classify(self, admin_client): def test_classify(self, admin_client):
locale, other_locale = LocaleFactory.create_batch(2) locale, other_locale = LocaleFactory.create_batch(2)
country = CountryFactory() country = CountryFactory()

Просмотреть файл

@ -137,10 +137,9 @@ class TestRecipe(object):
assert recipe.matches(client, exclude=[match_enabled]) assert recipe.matches(client, exclude=[match_enabled])
def test_filter_exclude_many(self): def test_filter_exclude_many(self):
locale1, locale2 = LocaleFactory.create_batch(2) locale_match1, locale_match2, locale_not = LocaleFactory.create_batch(3)
locale2 = LocaleFactory() recipe = RecipeFactory(locales=[locale_match1, locale_match2])
recipe = RecipeFactory(locales=[locale1]) client = ClientFactory(locale=locale_not.code)
client = ClientFactory(locale=locale2.code)
assert not recipe.matches(client) assert not recipe.matches(client)
assert recipe.matches(client, exclude=[get_locales]) assert recipe.matches(client, exclude=[get_locales])