class TestCompileFilterCommand(unittest.TestCase):
    def setUp(self):
        self.client = client.PushwooshClient()
        self.command = CompileFilterCommand()
        self.code = '0000-0000'

    def test_valid_compile_filter(self):
        auth = 'test_auth'
        expected_result = {
            'request': {
                'devices_filter': 'A("%s")' % self.code,
                'auth': auth
            }
        }
        self.command.auth = auth
        self.command.devices_filter = ApplicationFilter(self.code)

        command_dict = json.loads(self.command.render())
        self.assertDictEqual(command_dict, expected_result)

    def test_invalid_auth(self):
        self.command.devices_filter = ApplicationFilter(self.code)
        self.assertRaises(PushwooshCommandException, self.command.render)
class TestCompileFilterCommand(unittest.TestCase):

    def setUp(self):
        self.client = client.PushwooshClient()
        self.command = CompileFilterCommand()
        self.code = '0000-0000'

    def test_valid_compile_filter(self):
        auth = 'test_auth'
        expected_result = {
            'request': {
                'devices_filter': 'A("%s")' % self.code,
                'auth': auth
            }
        }
        self.command.auth = auth
        self.command.devices_filter = ApplicationFilter(self.code)

        command_dict = json.loads(self.command.render())
        self.assertDictEqual(command_dict, expected_result)

    def test_invalid_auth(self):
        self.command.devices_filter = ApplicationFilter(self.code)
        self.assertRaises(PushwooshCommandException, self.command.render)
 def setUp(self):
     self.client = client.PushwooshClient()
     self.command = CompileFilterCommand()
     self.code = '0000-0000'
Example #4
0
 def setUp(self):
     self.client = client.PushwooshClient()
     self.command = CompileFilterCommand()
     self.code = '0000-0000'
Example #5
0
    def setUp(self):
        super(TestCompileFilterCommand, self).setUp()

        self.command = CompileFilterCommand()
Example #6
0
    def setUp(self):
        super(TestCompileFilterCommand, self).setUp()

        self.client = client.PushwooshClient()
        self.command = CompileFilterCommand()