odoo_dev 开发培训作业:图书管理系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
736B

  1. # -*- coding: utf-8 -*-
  2. from odoo.tests.common import TransactionCase
  3. class TestBookState(TransactionCase):
  4. def setUp(self, *args, **kwargs):
  5. super(TestBookState, self).setUp(*args, **kwargs)
  6. self.test_book = self.env['library.book'].create({'name': 'Book 1'})
  7. def test_button_available(self):
  8. """Make available button"""
  9. self.test_book.make_available() #调用测试方法
  10. self.assertEqual(self.test_book.state, 'available', 'Book state should changed to available') #返回测试结果
  11. def test_button_lost(self):
  12. """Make lost button"""
  13. self.test_book.make_lost()
  14. self.assertEqual(self.test_book.state, 'lost', 'Book state should changed to lost')
上海开阖软件有限公司 沪ICP备12045867号-1