Esempio n. 1
0
    def test_valid_create_by_application_group(self):
        self.command = CreateMessageForApplicationGroupCommand(
            self.notification, application_group=PW_APP_GROUP_CODE)
        self.command.auth = self.auth
        response = self.client.invoke(self.command)

        self.assertEqual(response['status_code'], HTTP_200_OK)
        self.assertEqual(response['status_message'], STATUS_OK)
        self.assertEqual(True, 'Messages' in response['response'])
    def test_valid_create_by_application_group(self):
        expected_result = {
            'request': {
                'applications_group': self.code,
                'auth': self.auth,
                'notifications': [{
                    'content': 'Hello world!',
                    'send_date': 'now'
                }]
            }
        }
        self.command = CreateMessageForApplicationGroupCommand(
            self.notification, application_group=self.code)
        self.command.auth = self.auth

        command_dict = json.loads(self.command.render())
        self.assertDictEqual(command_dict, expected_result)
Esempio n. 3
0
 def test_create_message_without_application_group(self):
     self.command = CreateMessageForApplicationGroupCommand(self.notification)
     self.command.auth = self.auth
     self.assertRaises(PushwooshCommandException, self.command.compile)