Esempio n. 1
0
	def test_application_id_required(self):
		"""Using AppConfig without an application_id raises ImproperlyConfigured."""

		manager = AppConfig()
		with self.assertRaises(ImproperlyConfigured) as ic:
			manager._get_application_settings(None, None, None)

		self.assertEqual(
			str(ic.exception),
			"push_notifications.conf.AppConfig requires the application_id be "
			"specified at all times."
		)
	def test_application_not_found(self):
		"""
		Using AppConfig with an application_id that does not exist raises
		ImproperlyConfigured.
		"""

		application_id = "my_fcm_app"

		manager = AppConfig()

		with self.assertRaises(ImproperlyConfigured):
			manager._get_application_settings(application_id, "FCM", "API_KEY")
Esempio n. 3
0
    def test_application_not_found(self):
        """
		Using AppConfig with an application_id that does not exist raises
		ImproperlyConfigured.
		"""

        application_id = "my_fcm_app"

        manager = AppConfig()

        with self.assertRaises(ImproperlyConfigured):
            manager._get_application_settings(application_id, "FCM", "API_KEY")
Esempio n. 4
0
	def test_application_not_found(self):
		"""Using AppConfig with an application_id that does not exist raises
		ImproperlyConfigured."""

		application_id = "my_fcm_app"

		manager = AppConfig()

		with self.assertRaises(ImproperlyConfigured) as ic:
			manager._get_application_settings(application_id, "FCM", "API_KEY")

		self.assertEqual(
			str(ic.exception),
			"No application configured with application_id: {}.".format(application_id)
		)
	def test_platform_invalid_setting(self):
		"""
		Fetching application settings for the wrong platform raises ImproperlyConfigured.
		"""

		application_id = "my_fcm_app"
		PUSH_SETTINGS = {
			"APPLICATIONS": {
				application_id: {
					"PLATFORM": "FCM",
					"API_KEY": "[my_api_key]"
				}
			}
		}

		manager = AppConfig(PUSH_SETTINGS)

		with self.assertRaises(ImproperlyConfigured):
			manager._get_application_settings(application_id, "APNS", "CERTIFICATE")
Esempio n. 6
0
	def test_platform_invalid_setting(self):
		"""
		Fetching application settings for the wrong platform raises ImproperlyConfigured.
		"""

		application_id = "my_fcm_app"
		PUSH_SETTINGS = {
			"APPLICATIONS": {
				application_id: {
					"PLATFORM": "FCM",
					"API_KEY": "[my_api_key]"
				}
			}
		}

		manager = AppConfig(PUSH_SETTINGS)

		with self.assertRaises(ImproperlyConfigured):
			manager._get_application_settings(application_id, "APNS", "CERTIFICATE")
Esempio n. 7
0
	def test_platform_invalid_setting(self):
		"""Fetching application settings for the wrong platform raises ImproperlyConfigured."""

		application_id = "my_fcm_app"

		PUSH_SETTINGS = {
			"APPLICATIONS": {
				application_id: {
					"PLATFORM": "FCM",
					"API_KEY": "[my_api_key]"
				}
			}
		}

		manager = AppConfig(PUSH_SETTINGS)

		with self.assertRaises(ImproperlyConfigured) as ic:
			manager._get_application_settings(application_id, "APNS", "CERTIFICATE")

		self.assertEqual(
			str(ic.exception),
			"Application 'my_fcm_app' (FCM) does not support the setting 'CERTIFICATE'."
		)
	def test_application_id_required(self):
		"""Using AppConfig without an application_id raises ImproperlyConfigured."""

		manager = AppConfig()
		with self.assertRaises(ImproperlyConfigured):
			manager._get_application_settings(None, None, None)
Esempio n. 9
0
    def test_application_id_required(self):
        """Using AppConfig without an application_id raises ImproperlyConfigured."""

        manager = AppConfig()
        with self.assertRaises(ImproperlyConfigured):
            manager._get_application_settings(None, None, None)