Here are the examples of the python api django.conf.settings.OPENIDC_EMAIL_HEADER taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
50 Examples
3
View Complete Implementation : test_views.py
Copyright Mozilla Public License 2.0
Author : mozilla
Copyright Mozilla Public License 2.0
Author : mozilla
def test_google_yyyytics_omitted_if_setting_false(self):
with self.settings(USE_GOOGLE_yyyYTICS=False):
headers = {settings.OPENIDC_EMAIL_HEADER: "[email protected]"}
response = self.client.get(reverse("home"), **headers)
self.astertEqual(response.status_code, 200)
html = response.content.decode("utf-8")
# Note the 'not'!
self.astertNotIn("www.googletagmanager.com", html)
3
View Complete Implementation : test_views.py
Copyright Mozilla Public License 2.0
Author : mozilla
Copyright Mozilla Public License 2.0
Author : mozilla
def test_google_yyyytics_included_if_setting_true(self):
with self.settings(USE_GOOGLE_yyyYTICS=True):
headers = {settings.OPENIDC_EMAIL_HEADER: "[email protected]"}
response = self.client.get(reverse("home"), **headers)
self.astertEqual(response.status_code, 200)
html = response.content.decode("utf-8")
self.astertIn("www.googletagmanager.com", html)
3
View Complete Implementation : test_admin.py
Copyright Mozilla Public License 2.0
Author : mozilla
Copyright Mozilla Public License 2.0
Author : mozilla
def test_returns_200(self):
user = UserFactory()
user.is_staff = True
user.is_superuser = True
user.save()
experiment = ExperimentFactory.create_with_status(ExperimentFactory.STATUS_DRAFT)
response = self.client.get(
reverse(
"admin:experiments_experiment_change", kwargs={"object_id": experiment.id}
),
**{settings.OPENIDC_EMAIL_HEADER: user.email},
)
self.astertEqual(response.status_code, 200)
3
View Complete Implementation : test_api_views.py
Copyright Mozilla Public License 2.0
Author : mozilla
Copyright Mozilla Public License 2.0
Author : mozilla
def test_get_experiment_returns_experiment_info(self):
user_email = "[email protected]"
experiment = ExperimentFactory.create_with_variants()
response = self.client.get(
reverse("experiments-api-detail", kwargs={"slug": experiment.slug}),
**{settings.OPENIDC_EMAIL_HEADER: user_email},
)
self.astertEqual(response.status_code, 200)
json_data = json.loads(response.content)
serialized_experiment = ExperimentSerializer(experiment).data
self.astertEqual(serialized_experiment, json_data)
3
View Complete Implementation : test_api_views.py
Copyright Mozilla Public License 2.0
Author : mozilla
Copyright Mozilla Public License 2.0
Author : mozilla
def test_get_experiment_recipe_returns_recipe_info(self):
user_email = "[email protected]"
experiment = ExperimentFactory.create_with_variants(
normandy_slug="a-normandy-slug"
)
response = self.client.get(
reverse("experiments-api-recipe", kwargs={"slug": experiment.slug}),
**{settings.OPENIDC_EMAIL_HEADER: user_email},
)
self.astertEqual(response.status_code, 200)
json_data = json.loads(response.content)
serialized_experiment = ExperimentRecipeSerializer(experiment).data
self.astertEqual(serialized_experiment, json_data)
3
View Complete Implementation : test_api_views.py
Copyright Mozilla Public License 2.0
Author : mozilla
Copyright Mozilla Public License 2.0
Author : mozilla
def test_put_raises_409_if_email_already_sent(self):
experiment = ExperimentFactory.create_with_variants(
review_intent_to_ship=True, status=Experiment.STATUS_REVIEW
)
response = self.client.put(
reverse(
"experiments-api-send-intent-to-ship-email",
kwargs={"slug": experiment.slug},
),
**{settings.OPENIDC_EMAIL_HEADER: "[email protected]"},
)
self.astertEqual(response.status_code, 409)
3
View Complete Implementation : test_api_views.py
Copyright Mozilla Public License 2.0
Author : mozilla
Copyright Mozilla Public License 2.0
Author : mozilla
def test_patch_to_view_returns_clone_name_and_url(self):
experiment = ExperimentFactory.create(
name="great experiment", slug="great-experiment"
)
user_email = "[email protected]"
data = json.dumps({"name": "best experiment"})
response = self.client.patch(
reverse("experiments-api-clone", kwargs={"slug": experiment.slug}),
data,
content_type="application/json",
**{settings.OPENIDC_EMAIL_HEADER: user_email},
)
self.astertEqual(response.status_code, 200)
self.astertEqual(response.json()["name"], "best experiment")
self.astertEqual(response.json()["clone_url"], "/experiments/best-experiment/")
3
View Complete Implementation : test_api_views.py
Copyright Mozilla Public License 2.0
Author : mozilla
Copyright Mozilla Public License 2.0
Author : mozilla
def test_get_design_pref_returns_design_info(self):
user_email = "[email protected]"
experiment = ExperimentFactory.create_with_variants(type="pref")
response = self.client.get(
reverse("experiments-design-pref", kwargs={"slug": experiment.slug}),
**{settings.OPENIDC_EMAIL_HEADER: user_email},
)
self.astertEqual(response.status_code, 200)
json_data = json.loads(response.content)
serialized_experiment = ExperimentDesignPrefSerializer(experiment).data
self.astertEqual(serialized_experiment, json_data)
3
View Complete Implementation : test_api_views.py
Copyright Mozilla Public License 2.0
Author : mozilla
Copyright Mozilla Public License 2.0
Author : mozilla
def test_get_design_multi_pref_returns_design_info(self):
response = self.client.get(
reverse(
"experiments-design-multi-pref", kwargs={"slug": self.experiment.slug}
),
**{settings.OPENIDC_EMAIL_HEADER: self.user_email},
)
self.astertEqual(response.status_code, 200)
json_data = json.loads(response.content)
serialized_experiment = ExperimentDesignMultiPrefSerializer(self.experiment).data
self.astertEqual(serialized_experiment, json_data)
3
View Complete Implementation : test_api_views.py
Copyright Mozilla Public License 2.0
Author : mozilla
Copyright Mozilla Public License 2.0
Author : mozilla
def test_get_design_addon_returns_design_info(self):
user_email = "[email protected]"
experiment = ExperimentFactory.create_with_variants(
type=ExperimentConstants.TYPE_ADDON
)
response = self.client.get(
reverse("experiments-design-addon", kwargs={"slug": experiment.slug}),
**{settings.OPENIDC_EMAIL_HEADER: user_email},
)
self.astertEqual(response.status_code, 200)
json_data = json.loads(response.content)
serialized_experiment = ExperimentDesignAddonSerializer(experiment).data
self.astertEqual(serialized_experiment, json_data)