예제 #1
0
	def test_send_message_calls_wns_send_with_xml(self, mock_method, _):
		wns_send_message(uri="one", xml_data={"key": "value"})
		mock_method.assert_called_with(
			application_id=None, uri="one", data=b"<toast />", wns_type="wns/toast"
		)
예제 #2
0
	def test_send_message_raises_TypeError_if_one_of_the_data_params_arent_filled(self):
		with self.assertRaises(TypeError):
			wns_send_message(uri="one")
예제 #3
0
	def test_send_message_calls_wns_send_with_application_id(self, mock_method, _):
		wns_send_message(uri="one", message="test message", application_id="123456")
		mock_method.assert_called_with(
			application_id="123456", uri="one", data="this is expected", wns_type="wns/toast"
		)
	def test_send_message_calls_wns_send_with_xml_if_xml_data_is_passed(self, mock_method):
		wns_send_message(uri='one', raw_data='expected data')
		mock_method.assert_called_with(uri='one', data='expected data', wns_type='wns/raw',
										package_id=None, secret_key=None)
	def test_send_message_calls_wns_send_with_xml_if_xml_data_is_passed(self, mock_method, _):
		wns_send_message(uri='one', xml_data={'key': 'value'})
		mock_method.assert_called_with(uri='one', data=b'<toast />', wns_type='wns/toast',
										package_id=None, secret_key=None)
	def test_send_message_calls_wns_send_with_toast_if_string_is_passed_to_message(self, mock_method, _):
		wns_send_message(uri='one', message='test message')
		mock_method.assert_called_with(uri='one', data='this is expected', wns_type='wns/toast',
										package_id=None, secret_key=None)
예제 #7
0
	def test_send_message_calls_wns_send_with_toast(self, mock_method, _):
		wns_send_message(uri="one", message="test message")
		mock_method.assert_called_with(uri="one", data="this is expected", wns_type="wns/toast")