def test_test_config(self): config = WalintParser() config.readfp(io.BytesIO(_SAMPLE_CONFIG)) test = WalintTestCase.from_config(config, "test:testone") self.assertEquals(test.name, "testone") self.assertEqual(test.setup, foo) self.assertEqual(test.teardown, foo) self.assertEqual(test.services, [("foo", ["GET", ]), ("bar", METHS)]) self.assertEqual(test.controllers, [("ctrl1", ["param1", "param2"]), ]) # test we expand "* *" the right way test2 = WalintTestCase.from_config(config, "test:test2") self.assertEqual(len(config.get_services()), len(test2.services)) self.assertEqual([i[1] for i in test2.services][0], METHS) # * should work as well for controllers self.assertEqual(len(config.get_controllers()), len(test2.controllers)) # test exclusion works with ~ # ... for services test3 = WalintTestCase.from_config(config, "test:test3") self.assertFalse("foo" in dict(test3.services).keys()) self.assertFalse("baz" in dict(test3.services).keys()) # ... and for controllers self.assertTrue("ctrl1" not in dict(test3.controllers).keys())
def main(filename): # load the config config = WalintParser() config.read(filename) stream = config.get('walint', 'stream') # creating the app client app = build_app(config.get('walint', 'root')) # now running the tests results = run(app, config.get_tests(), config.get_controllers(), config.get_services(), config.get_singles(), config.root_options(), stream) return results