def test_decoApiCallAddDevKey(dummy_api):
    " decorator test: argsOptional should be extended with devKey"
     
    registerMethod('a_func')
    @decoApiCallAddDevKey
    def a_func(a_api, *argsPositional, **argsOptional):
        return argsPositional, argsOptional
     
    # check method argument definition
    allArgs = getArgsForMethod('a_func')
    assert (['devKey'], []) == allArgs
    # check call arguments
    response = a_func(dummy_api)
    assert {'devKey' : dummy_api.devKey} == response[1]
 def test_decoApiCallAddDevKey(self):
     " decorator test: argsOptional should be extended with devKey"
     
     registerMethod('a_func')
     @decoApiCallAddDevKey
     def a_func(a_api, *argsPositional, **argsOptional):
         return argsPositional, argsOptional
     
     # check method argument definition
     allArgs = getArgsForMethod('a_func')
     self.assertEqual((['devKey'], []), allArgs)
     # check call arguments
     response = a_func(self.api)
     self.assertEqual({'devKey' : self.api.devKey}, response[1])
def test_decoApiCallAddDevKey(dummy_api):
    " decorator test: argsOptional should be extended with devKey"
     
    registerMethod('a_func')
    @decoApiCallAddDevKey
    def a_func(a_api, *argsPositional, **argsOptional):
        return argsPositional, argsOptional
     
    # check method argument definition
    allArgs = getArgsForMethod('a_func')
    assert (['devKey'], []) == allArgs
    # check call arguments
    response = a_func(dummy_api)
    assert {'devKey' : dummy_api.devKey} == response[1]
示例#4
0
    def test_decoApiCallAddDevKey(self):
        " decorator test: argsOptional should be extended with devKey"

        registerMethod('a_func')

        @decoApiCallAddDevKey
        def a_func(a_api, *argsPositional, **argsOptional):
            return argsPositional, argsOptional

        # check method argument definition
        allArgs = getArgsForMethod('a_func')
        self.assertEqual((['devKey'], []), allArgs)
        # check call arguments
        response = a_func(self.api)
        self.assertEqual({'devKey': self.api.devKey}, response[1])
 def test_decoApiCallAddAttachment(self):
     " decorator test: argsOptional should be extended attachment file infos"
     
     registerMethod('func_addAttachment')
     @decoApiCallAddAttachment
     def func_addAttachment(a_api, *argsPositional, **argsOptional):
         return argsPositional, argsOptional
     
     # check method argument definition
     allArgs = getArgsForMethod('func_addAttachment')
     self.assertEqual((['devKey'], ['attachmentfile']), allArgs)
     # check call arguments
     response = func_addAttachment(self.api, 'a_file')
     self.assertEqual({'devKey' : self.api.devKey, 'filename': 'name a_file',
                 'filetype': 'type a_file', 'content' : 'content a_file'}, 
                      response[1])
def test_decoApiCallAddAttachment(dummy_api):
    " decorator test: argsOptional should be extended attachment file infos"
     
    registerMethod('func_addAttachment')
    @decoApiCallAddAttachment
    def func_addAttachment(a_api, *argsPositional, **argsOptional):
        return argsPositional, argsOptional
     
    # check method argument definition
    allArgs = getArgsForMethod('func_addAttachment')
    assert (['devKey'], ['attachmentfile']) == allArgs
    # check call arguments
    response = func_addAttachment(dummy_api, 'a_file')
    assert response[1] == {'devKey' : dummy_api.devKey, 
                           'filename': 'name a_file',
                           'filetype': 'type a_file', 
                           'content' : 'content a_file'}