def _testMainRaisesSystemExit(self, arguments, expectedExitCode=0): assert arguments is not None actualArguments = ['test'] actualArguments.extend(arguments) try: xsc.main(actualArguments) self.fail("cmx.main() must raise SystemExit") # pragma: no cover except SystemExit, error: self.assertEqual(error.code, expectedExitCode, 'exit code is %d instead of %d with arguments: %s' % (error.code, expectedExitCode, actualArguments))
def testFailsOnMissingEndIf(self): # FIXME: Test for assertRaises XscSyntaxError exitCode, _ = xsc.main([ 'test', _MissingEndIfXscPath, 'customers:%s' % _testFilePath('customers.csv'), ]) self.assertEqual(exitCode, 0)
def testCanProcessNamespace(self): exitCode, _ = xsc.main([ 'test', _NamespaceXscPath, 'customers:%s' % _testFilePath('customers.csv'), ]) self.assertEqual(exitCode, 0) self.assertXmlFileMatches(_NamespaceXscPath)
def testCanProcessEmptyConstructs(self): exitCode, _ = xsc.main([ 'test', _EmptyXscPath, 'customers:%s' % _testFilePath('customers.csv'), ]) self.assertEqual(exitCode, 0) self.assertXmlFileMatches(_EmptyXscPath)
def testCanProcessEdm(self): exitCode, _ = xsc.main([ 'test', _EdmBalanceXscPath, 'edmNotification:%s@%s' % (_testFilePath('edmBalanceNotification.csv'), _testFilePath('cid_edmBalanceNotification.xls')), 'edmPeriod:%s@%s' % (_testFilePath('edmBalancePeriod.csv'), _testFilePath('cid_edmBalancePeriod.xls')) ]) self.assertEqual(exitCode, 0) self.assertXmlFileMatches(_EdmBalanceXscPath)
def testCanValidateEdm(self): exitCode, _ = xsc.main(['test', _EdmBalanceXscPath]) self.assertEqual(exitCode, 0)