Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion app/experimenter/experiments/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def test_filters_by_firefox_channel(self):
)


class TestExperimengOrderingForm(TestCase):
class TestExperimentOrderingForm(TestCase):

def test_accepts_valid_ordering(self):
ordering = ExperimentOrderingForm.ORDERING_CHOICES[1][0]
Expand Down Expand Up @@ -300,6 +300,36 @@ def test_list_view_filters_and_orders_experiments(self):
list(context["experiments"]), list(filtered_ordered_experiments)
)

def test_list_view_orders_experiments_firefox_channel_sort(self):
user_email = "user@example.com"
ordering = "firefox_channel_sort"
channels = [
Experiment.CHANNEL_RELEASE,
Experiment.CHANNEL_NIGHTLY,
Experiment.CHANNEL_BETA,
"",
]
for channel in channels:
ExperimentFactory.create(firefox_channel=channel)

response = self.client.get(
"{url}?{params}".format(
url=reverse("home"), params=urlencode({"ordering": ordering})
),
**{settings.OPENIDC_EMAIL_HEADER: user_email},
)

context = response.context[0]
self.assertEqual(
list(exp.firefox_channel for exp in context["experiments"]),
[
"",
Experiment.CHANNEL_NIGHTLY,
Experiment.CHANNEL_BETA,
Experiment.CHANNEL_RELEASE,
],
)

def test_list_view_total_experiments_count(self):
user_email = "user@example.com"

Expand Down