test_wishlist_process.py 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # -*- coding: utf-8 -*-
  2. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  3. import odoo.tests
  4. @odoo.tests.tagged('-at_install', 'post_install')
  5. class TestUi(odoo.tests.HttpCase):
  6. def test_01_wishlist_tour(self):
  7. self.env['product.template'].search([]).write({'website_published': False})
  8. # Setup attributes and attributes values
  9. self.product_attribute_1 = self.env['product.attribute'].create({
  10. 'name': 'Legs',
  11. 'sequence': 10,
  12. })
  13. product_attribute_value_1 = self.env['product.attribute.value'].create({
  14. 'name': 'Steel',
  15. 'attribute_id': self.product_attribute_1.id,
  16. 'sequence': 1,
  17. })
  18. product_attribute_value_2 = self.env['product.attribute.value'].create({
  19. 'name': 'Aluminium',
  20. 'attribute_id': self.product_attribute_1.id,
  21. 'sequence': 2,
  22. })
  23. product_attribute_2 = self.env['product.attribute'].create({
  24. 'name': 'Color',
  25. 'sequence': 20,
  26. })
  27. product_attribute_value_3 = self.env['product.attribute.value'].create({
  28. 'name': 'White',
  29. 'attribute_id': product_attribute_2.id,
  30. 'sequence': 1,
  31. })
  32. product_attribute_value_4 = self.env['product.attribute.value'].create({
  33. 'name': 'Black',
  34. 'attribute_id': product_attribute_2.id,
  35. 'sequence': 2,
  36. })
  37. # Create product template
  38. self.product_product_4_product_template = self.env['product.template'].create({
  39. 'name': 'Customizable Desk (TEST)',
  40. 'standard_price': 500.0,
  41. 'list_price': 750.0,
  42. 'website_published': True,
  43. })
  44. # Generate variants
  45. self.env['product.template.attribute.line'].create([{
  46. 'product_tmpl_id': self.product_product_4_product_template.id,
  47. 'attribute_id': self.product_attribute_1.id,
  48. 'value_ids': [(4, product_attribute_value_1.id), (4, product_attribute_value_2.id)],
  49. }, {
  50. 'product_tmpl_id': self.product_product_4_product_template.id,
  51. 'attribute_id': product_attribute_2.id,
  52. 'value_ids': [(4, product_attribute_value_3.id), (4, product_attribute_value_4.id)],
  53. }])
  54. self.env.ref('base.user_admin').name = 'Mitchell Admin'
  55. self.start_tour("/", 'shop_wishlist')
  56. def test_02_wishlist_admin_tour(self):
  57. attribute = self.env['product.attribute'].create({
  58. 'name': 'color',
  59. 'display_type': 'color',
  60. 'create_variant': 'always',
  61. })
  62. self.env['product.template'].create({
  63. 'name': 'Rock',
  64. 'is_published': True,
  65. 'attribute_line_ids': [(0, 0, {
  66. 'attribute_id': attribute.id,
  67. 'value_ids': [
  68. (0, 0, {
  69. 'name': 'red',
  70. 'attribute_id': attribute.id,
  71. }),
  72. (0, 0, {
  73. 'name': 'blue',
  74. 'attribute_id': attribute.id,
  75. }),
  76. (0, 0, {
  77. 'name': 'black',
  78. 'attribute_id': attribute.id,
  79. }),
  80. ],
  81. })],
  82. })
  83. self.start_tour("/", 'shop_wishlist_admin', login="admin")