Commit Graph
33 Commits
Author SHA1 Message Date
Raphael Collet 1398b6b44c [IMP] tests: deprecate SavepointCase
closes odoo/odoo#62031

Related: odoo/enterprise#14872
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-11-24 13:23:32 +00:00
Yannick Tivisse 813cd0b50b [IMP] website_forum: Adapt tests to work with/without demo data 2019-11-05 16:18:10 +01:00
fja-odoo 424adb63e3 [IMP] gamification, *: remove KarmaError
* = stock, test_website, web, website_forum, website_slides, base

Replace KarmaError with AccessError and remove the related override made
on crash_manager and ir_http.

task-2069890

closes odoo/odoo#36655

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-09-12 13:49:02 +00:00
Andrea Ulliana f9c2716b3e [IMP] website_forum: bring forum modes
It is now possible to specify the forum mode : Questions and Answers or
Discussions. In Q&A mode, a user can only reply once while there is no
limit in Discussions mode.

task-2008910

closes odoo/odoo#34097

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-08-02 16:32:29 +00:00
Raphael Collet b7fd679a6c [FIX] *: sudo() -> with_user() 2019-07-04 11:32:22 +00:00
Sébastien Theys df7326f0be [IMP] tests, *: add start_tour helper
Before this commit, the syntax to start a tour was extremely verbose.
With this new method, it is possible to start a tour by just giving the
essential parameter: the tour name.
The full set of features from browser_js are kept by using **kwargs.

closes odoo/odoo#32316

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2019-04-04 08:44:59 +00:00
David Beguin 3b9dcb6d8d [REF] gamification, website_forum: move karma, badge and badge level to gamification
Purpose of this commit is to prepare addition of gamification in slides /
eLearning platform. In order to be able to use karma and the badges in other
modules we move those models in gamification.

Partial commit linked to eLearning project. Main specifications related
to gamification and user profile can be found on task 1922159 (PR #30514).
Main specifications related to eLearning can be found on task 1902304
(PR #29876).
2019-02-07 12:11:44 +00:00
Romain Derie 1dac413130 [FIX] website_forum: limit portal/user rights on forum.post.vote
Create and write rights are granted on portal and user.
We need to improve the security.

task-1934286

task-1862656

opw-1862218
opw-1862111
opw-1857912
opw-1861426

Github-24986
forum-135070

closes odoo/odoo#25671
2019-01-29 09:57:10 +00:00
Raphael Collet 7ea4f13f16 [REF] tests: TestCursor is now a proxy to a real Cursor
This allows rpc requests in `HttpCase` to use the cursor `self.cr`, which is
now shared between the Python test and the rpc requests.  This simplifies code
to prepare a JS test, and code to check the result of a JS tour.

Fixes #12237
2018-02-12 10:31:59 +01:00
Christophe Monniez b356b19033 [IMP] tests: Add the possibility to tag tests
Purpose: When running tests, all the tests for the installed/updated
files are done. This commit adds a 'tagged' decorator that can be used to
tag tests. Combined with a new 'test-tags' CLI option, it adds the ability
to filter which tests are executed. For example, @tagged('slow') will
add a tag 'slow' to the test. The CLI option 'test-tags="slow"' will
only run tests tagged 'slow'.

One can use prefixes to select cases with tags.
'+' or no prefix means that the tests tagged with this tag are selected
for execution. '-' prefix will exclude the tests tagged with this tag.
Exclusion takes precedence over inclusion.

Also, by default, all Odoo tests cases are tagged 'standard' and with
the technical name of the module.
This means that when selecting tests with the 'test-tags'
parameter, if '-standard' is not specified, all tests tags are
going to be executed.
When tagging tests, one can remove such automatic tag by prefixing the
tag name with '-'. E.g. @tagged('-standard') will remove the standard
tag from the test.

Another example, if one wants to test the 'sale' module alone,
even without adding any 'tagged' decorator thos tests can be selected
like that: --test-tags="sale"

Tests are selected or deselected using a TagsSelector. When instanciated,
 a string is passed with comma separated tests selectors like
'+slow,-standard'. When the 'check' method is called  with a test as argument,
it returns True or False if the test has to be executed or not.
2018-01-18 13:20:37 +01:00
Thibault Delavallée 1fbc29a641 [MOV] base: move ir_* models into models/ 2017-11-27 11:15:03 +01:00
xmo-odoo b4429c2a91 [FIX] Various P3-related import changes
* LDAP import: python-ldap is not python3-compatible, pyldap is

  Warning: only supported from debian Stretch (current testing)?
  https://packages.debian.org/search?searchon=names&keywords=pyldap

* implicitly relative imports
* imports of moved or removed stdlib modules

issue #8530
2017-04-28 09:06:53 +02:00
Raphael Collet 0783318f97 [FIX] adapt logger names 2016-09-02 17:28:13 +02:00
Thibault Delavallée 029d1baf35 [REF] mail: remove required alias on users
This commit remove required alias on res.users model. It also removes the
inheritance of mail.alias.mixin. The field alias_id is kept and allow people
to use aliases on users if they want. However there is no default void alias
created for each user anymore.

Default from of mail.message does not use user alias anymore. Indeed this
creates issues with aliases not being correctly configured and can be
confusing compared to private channels. Using user aliases is therefore
now done manually instead of being a default behavior.
2016-09-01 13:19:24 +02:00
Christophe Matthieu d39fbea9ad [IMP] website_forum: convert tours to use web_tour.tour 2016-08-30 13:54:28 +02:00
qsm-odoo f9a84b5ebc [IMP] web_tour, *: allow to properly extend tours
* crm, project, website, website_event, website_blog, website_forum,
website_sale

Eg: the tour 'shop_buy_product' is extended by the website_sale_options
addons to add a step to close a modal.

The current solution was requiring the module that defines the tour
to extend, then add/remove steps in the "step" key of the tour
definition.
Some of the problems with this method were:
* The "register" method calls the "update" method to immediately
search for tip to place once registered (as register may be called
after the DOM is ready). So extensions of tours were happening after
the tours were started (and the tours were not restarted).
* The addition/removal of steps was happening after they were filtered
according to the "edition" key.

To allow extension, the system is changed as follow:
* The "register" method now only saves the steps and options without
modifying them and does not call the "update" method.
* Once the DOM was ready, the tour service started listening to DOM
mutations and called the "update" tour method. Now, this "update" call
is replaced by a "_register_all" call, on DOM ready and at the end of
the current call stack (which makes sure all modules are loaded). This
"_register_all" method marks the registered tours as ready after having
filtered the steps according to the "edition" key and initialized the
current step to trigger.
* Also, tours can now define a "wait_for" option which allow them to
be marked as ready for run and update after the given deferred. Those
tours can now also be extended without having to wait for the deferred.
PhamtomJS must wait for the "ready" key to be true to run the tour.
2016-08-26 13:39:55 +02:00
Christophe Simonis 9d63b8d492 [FIX] website_forum: ensure demo user have enough karma to post non-pending questions 2016-08-21 22:20:36 +02:00
Thibault Delavallée 78797a4b17 [MIG] website_forum: migrate remaining message_post and update code accordingly 2016-08-10 15:48:09 +02:00
Thibault Delavallée c8a313d51e [IMP] various: use odoo for imports instead of openerp and update class names 2016-08-10 15:48:07 +02:00
qsm-odoo eaf8e82efb [IMP] *: activate automatic tour tests
* project, crm, point_of_sale, website, website_sale, website_blog,
website_event, website_forum
2016-07-18 14:22:29 +02:00
qsm-odoo 0e43c9c43c [FIX] website_forum: link the .py test file...
Commit cf925c2a58 introduced the test_forum_process file which launches
the UI tests of the website_forum module. Unfortunatly, the file was
not linked in the __init__.py file.
2016-07-18 11:25:21 +02:00
jas 284d82623f [IMP] website_forum : tag update
It is now possible to follow tags in the forum app. When following tags you
will be notified for every new post linking this tag.

A small karma update is also performed. We now correctly use karma to retag
posts, and karma to create new tags.
2015-11-26 15:16:00 +01:00
Thibault Delavallée a6b6d02007 [FIX] website_forum: do the todo
We have a tunable parameter for flagged / offensive questions. So let us use
it instead of some other parameter * 5.
2015-11-20 11:51:49 +01:00
Julien Louette 205ce98656 [IMP] website_forum: moderation & anti spam 2015-09-05 14:44:06 +02:00
Antony Lesuisse 1e90257e58 [IMP] tags: add unique constraints
- remove tags translatability
- add unique constraints
- res.partner.category is kept until we remove the parent_store test.
- hr remove tag parenthood
- hr remove unsed views and menu
2015-08-07 00:51:14 +02:00
Christophe Simonis a304194936 [MERGE] forward port of branch saas-6 up to 81b5c60 2015-06-25 00:26:31 +02:00
Christophe Simonis 704a11ddee [MERGE] forward port of branch 8.0 up to b8bf1e0 2015-06-24 12:45:14 +02:00
Xavier Morel 11ba4689b1 [IMP] running speed of some tests & new testcase type
Some tests (e.g. mail) have expensive and significant DB setup for a
number of small and cheap tests. Using a TransactionCase, the DB setup
far dominates the tests themselves, by up to 10x (mail unit tests take
~130s on my machine, the tests themselves take ~15s).

The SavepointCase introduced here is an hybrid of SingleTransactionCase
and TransactionCase: it uses a single transaction for all tests in a
class, but each test case is isolated by a rollbacked savepoint. This
allows a common DB setup (via setUpClass) while keeping independent
tests.

TransactionCase should remain the primary test case superclass, but
SavepointCase can be a fair optimisation when setup costs far dominate.
2015-06-23 16:38:14 +02:00
Thibault Delavallée 4b122ad41d [MIGR] mail: migration to the new API 2015-04-27 10:36:15 +02:00
Géry Debongnie ebc39b8788 [FIX] update tests to new module system
Various tests (mostly tours) were broken with the large changes in the
way the js code works.
2015-03-18 09:23:37 +01:00
Mitesh Savani cf925c2a58 [TEST] website_forum: add testing tour for the forum. 2015-03-11 14:58:20 +01:00
Goffin Simon 0fd773a486 [IMP] Cleanup and refactoring of exception handling
Unify and refactor exception handling in framework and addons.

The generic `except_osv` is now deprecated, and replaced by more specialized exception subtypes:
 - `UserError` (renamed from Warning, as it conflicts with the built-in `Warning`) raised when a non-technical error occurs during a business operation. It could be a missing information in the data provided by the user, or a misconfiguration.
 - `AccessError`: raised when any operation is denied because the user conducting it does not have the required access rights.
 - `AccessDenied`: raised when an operation that requires authenticated access is attempted via an unauthenticated request.
 - `MissingError`: raised when an operation is attempted on a record that does not exist.
 - `ValidationError`: raised when an operation violates a SQL or Python constraint.
 - All other exceptions are internal errors due to a system problem or bug, and raised untouched to the client-side, which should display a traceback.

All exceptions take a single message argument.

The `test_exceptions` module has been updated to showcase both new and old (deprecated) exceptions.

A great many old `except_osv` had a useless title with "Error!" or "Warning", those have been removed, as this is handled by the client-side widget that displays the messages.

This commit introduces a more consistent policy for logging errors and warnings:
 - All messages that do not require administrator attention should be logged at INFO level or lower. This includes all errors that are notified to the user in a friendly manner, even for access right problems or validation errors during business operations.
 - All messages that indicate a likely misconfiguration or malicious use by the users should be logged at WARNING level, as they typically require administrator attention.
 - All other unhandled internal errors cannot typically be handled by the user and should be logged at ERROR or higher level, as they require immediate administrator attention.
2015-01-16 17:15:18 +01:00
ssh-odoo ef8099424d [IMP] [TEST] website_forum: security fixes + tests
- fixed voting, karma check could be avoided
- fixed posting comments, now correctly checking karma (not for
notifications)
- fixed bootstraping of users, now not allowed to ask questions by default;
added validation email that gives the first karma points required to
participate
- added tests
2014-10-23 11:36:03 +02:00