Esempio n. 1
0
    def test_call(self):
        mock = Mock()
        b = Baan('Baan.Application.erpln', dispatcher=mock)

        baanmock = mock.return_value

        b.ottstpapihand.stpapi.put.field("tcibd0501m000", "tcibd001.item", "TEST")

        baanmock.ParseExecFunction.assert_called_with(
            'ottstpapihand',
            'stpapi.put.field("tcibd0501m000", "tcibd001.item", "TEST")',
        )

        b.test.some.foo("test", 10)
        baanmock.ParseExecFunction.assert_called_with(
            'test',
            'some.foo("test", 10)',
        )

        b.test.some.foo("test", 10.0)
        baanmock.ParseExecFunction.assert_called_with(
            'test',
            'some.foo("test", 10.0)',
        )

        b.close()
Esempio n. 2
0
    def test_method_name(self):
        b = Baan('Baan.Application.erpln', dispatcher=Mock())
        self.assertEqual(b.ottstpapihand.stpapi._method_name,
                         "stpapi")
        self.assertEqual(b.ottstpapihand.stpapi.put.field._method_name,
                         "stpapi.put.field")

        b.close()
Esempio n. 3
0
    def test_get_calling_method(self):
        b = Baan('Baan.Application.erpln', dispatcher=Mock())
        wrapper = b.ottstpapihand.stpapi.put.field
        calling_method = wrapper._get_calling_method(
            *('tcibd0501m000', 'tcibd001.item', 'TEST'))

        self.assertEqual(
            'stpapi.put.field("tcibd0501m000", "tcibd001.item", "TEST")',
            calling_method
        )

        b.close()