Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_init1(self):
# Server + Protocol + Port
odoo = odoorpc.ODOO(ARGS.server, ARGS.protocol, ARGS.port)
self.assertIsInstance(odoo, odoorpc.ODOO)
self.assertIsNotNone(odoo)
self.assertEqual(odoo.server, ARGS.server)
self.assertEqual(odoo.protocol, ARGS.protocol)
self.assertEqual(odoo.port, ARGS.port)
def test_logout(self):
odoo = odoorpc.ODOO(
ARGS.server, protocol=ARGS.protocol, port=ARGS.port,
version=ARGS.version)
user = odoo.login(ARGS.database, ARGS.user, ARGS.passwd)
success = odoo.logout()
self.assertTrue(success)
def test_session_odoo_load(self):
self.odoo.save(self.session_name, rc_file=self.file_path)
odoo = odoorpc.ODOO.load(self.session_name, rc_file=self.file_path)
self.assertIsInstance(odoo, odoorpc.ODOO)
self.assertEqual(self.odoo.server, odoo.server)
self.assertEqual(self.odoo.port, odoo.port)
self.assertEqual(self.odoo.db, odoo.db)
self.assertEqual(self.odoo.protocol, odoo.protocol)
self.assertEqual(self.odoo.user, odoo.user)
odoorpc.ODOO.remove(self.session_name, rc_file=self.file_path)
def test_login(self):
odoo = odoorpc.ODOO(
ARGS.server, protocol=ARGS.protocol, port=ARGS.port,
version=ARGS.version)
user = odoo.login(ARGS.database, ARGS.user, ARGS.passwd)
self.assertIsNotNone(user)
self.assertIsInstance(user, osv.BrowseRecord)
self.assertEqual(odoo.user, user)
self.assertEqual(odoo.db, ARGS.database)
def setUp(self):
self.odoo = odoorpc.ODOO(
ARGS.server, protocol=ARGS.protocol, port=ARGS.port,
version=ARGS.version)
def test_init2(self):
# Server + Protocol + Port + Timeout
odoo = odoorpc.ODOO(ARGS.server, ARGS.protocol, ARGS.port, 42)
self.assertIsInstance(odoo, odoorpc.ODOO)
self.assertIsNotNone(odoo)
self.assertEqual(odoo.server, ARGS.server)
self.assertEqual(odoo.protocol, ARGS.protocol)
self.assertEqual(odoo.port, ARGS.port)
self.assertEqual(odoo.config['timeout'], 42)
def test_logout(self):
odoo = odoorpc.ODOO(
ARGS.server, protocol=ARGS.protocol, port=ARGS.port,
version=ARGS.version)
user = odoo.login(ARGS.database, ARGS.user, ARGS.passwd)
success = odoo.logout()
self.assertTrue(success)
def setUp(self):
self.odoo = odoorpc.ODOO(
ARGS.server, protocol=ARGS.protocol, port=ARGS.port,
version=ARGS.version)
self.user = self.odoo.login(ARGS.database, ARGS.user, ARGS.passwd)
def test_login_no_password(self):
# login no password => Error
odoo = odoorpc.ODOO(
ARGS.server, protocol=ARGS.protocol, port=ARGS.port,
version=ARGS.version)
self.assertRaises(
odoorpc.error.Error,
odoo.login, ARGS.user)
def setUp(self):
self.odoo = odoorpc.ODOO(
ARGS.server, protocol=ARGS.protocol, port=ARGS.port,
version=ARGS.version)
self.user = self.odoo.login(ARGS.database, ARGS.user, ARGS.passwd)