# Path: coherence/upnp/core/action.py
# class Argument:
# class Action(log.Loggable):
#     def __init__(self, name, direction, state_variable):
#     def get_name(self):
#     def get_direction(self):
#     def get_state_variable(self):
#     def __repr__(self):
#     def as_tuples(self):
#     def as_dict(self):
#     def __init__(self, service, name, implementation, arguments_list):
#     def _get_client(self):
#     def get_name(self):
#     def get_implementation(self):
#     def get_arguments_list(self):
#     def get_in_arguments(self):
#     def get_out_arguments(self):
#     def get_service(self):
#     def set_callback(self, callback):
#     def get_callback(self):
#     def call(self, *args, **kwargs):
#     def _got_error(self, failure):
#     def _got_results(self, results, instance_id, name):
#     def __repr__(self):
#     def as_tuples(self):
#     def as_dict(self):


import time
from twisted.trial import unittest
from twisted.internet import protocol
from twisted.internet.defer import Deferred, DeferredList
from twisted.test import proto_helpers
from coherence.upnp.core import action
from coherence.test import wrapped
        def check_result(*args, **kw):
            self.assertEqual(
                self.service.get_state_variable('Brightness').value,
                12)
            self.assertEqual(client._called_action_name, 'SomeTestAction')
            self.assertEqual(client._passed_arguments,
                             {'InstanceID': 23, 'Color': 'red'})

        self.assertIs(self.service.get_state_variable('Brightness').value,
                      NoImplementation)
        client = DummyClient({'CurrentBrightness': 12} )
        self.service._set_client(client)
        result = self.action.call(InstanceID=23, Color='red')
        result.addCallback(check_result)
        return result

    def test_call_action_extraneous_result_values(self):
        """
        Check if extraneous result values are silently ignored.
        """
        # NB: This behaviour is new in coherence 0.7. Former versions
        # would raise an IndexError.

        def check_result(*args, **kw):
            self.assertEqual(
                self.service.get_state_variable('Brightness').value,
                12)

        client = DummyClient({'CurrentBrightness': 12, 'XtraValue': 456})
        self.service._set_client(client)

# Path: coherence/upnp/core/action.py
# class Argument:
# class Action(log.Loggable):
#     def __init__(self, name, direction, state_variable):
#     def get_name(self):
#     def get_direction(self):
#     def get_state_variable(self):
#     def __repr__(self):
#     def as_tuples(self):
#     def as_dict(self):
#     def __init__(self, service, name, implementation, arguments_list):
#     def _get_client(self):
#     def get_name(self):
#     def get_implementation(self):
#     def get_arguments_list(self):
#     def get_in_arguments(self):
#     def get_out_arguments(self):
#     def get_service(self):
#     def set_callback(self, callback):
#     def get_callback(self):
#     def call(self, *args, **kwargs):
#     def _got_error(self, failure):
#     def _got_results(self, results, instance_id, name):
#     def __repr__(self):
#     def as_tuples(self):
#     def as_dict(self):


# Path: coherence/upnp/core/test/test_action.py
import time
from twisted.trial import unittest
from twisted.internet import protocol
from twisted.internet.defer import Deferred, DeferredList
from twisted.test import proto_helpers
from coherence.upnp.core import action
from coherence.test import wrapped

        def check_result(*args, **kw):
            self.assertEqual(
                self.service.get_state_variable('Brightness').value,
                12)
            self.assertEqual(client._called_action_name, 'SomeTestAction')
            self.assertEqual(client._passed_arguments,
                             {'InstanceID': 23, 'Color': 'red'})

        self.assertIs(self.service.get_state_variable('Brightness').value,
                      NoImplementation)
        client = DummyClient({'CurrentBrightness': 12} )
        self.service._set_client(client)
        result = self.action.call(InstanceID=23, Color='red')
        result.addCallback(check_result)
        return result

    def test_call_action_extraneous_result_values(self):
        """
        Check if extraneous result values are silently ignored.
        """
        # NB: This behaviour is new in coherence 0.7. Former versions
        # would raise an IndexError.

        def check_result(*args, **kw):
            self.assertEqual(
                self.service.get_state_variable('Brightness').value,
                12)

        client = DummyClient({'CurrentBrightness': 12, 'XtraValue': 456})
        self.service._set_client(client)

        result = self.action.call(InstanceID=23, Color='red')