How to use update_service method in tempest

Best Python code snippet using tempest_python

test_currency_rate_update.py

Source: test_currency_rate_update.py Github

copy

Full Screen

1# © 2017 Comunitea2# License AGPL-3.0 or later (http:/​/​www.gnu.org/​licenses/​agpl).3from odoo.tests import common4from odoo import exceptions, fields5class TestCurrencyRateUpdate(common.SavepointCase):6 def setUp(self):7 super(TestCurrencyRateUpdate, self).setUp()8 self.company = self.env['res.company'].create({9 'name': 'Test company',10 'currency_id': self.env.ref('base.EUR').id,11 })12 self.env.user.company_ids += self.company13 self.env.user.company_id = self.company14 self.currency = self.env.ref('base.USD')15 self.update_service = self.env['currency.rate.update.service'].create({16 'service': 'ECB',17 'currency_to_update':18 [(4, self.currency.id),19 (4, self.env.user.company_id.currency_id.id)]20 })21 currency_rates = self.env['res.currency.rate'].search(22 [('currency_id', '=', self.currency.id)])23 currency_rates.unlink()24 def test_currency_rate_update_ECB(self):25 self.update_service.refresh_currency()26 currency_rates = self.env['res.currency.rate'].search(27 [('currency_id', '=', self.currency.id)])28 self.assertTrue(currency_rates)29 def test_constrains_max_delta_days(self):30 with self.assertRaises(exceptions.ValidationError):31 self.update_service.write({'max_delta_days': -5})32 def test_constrains_interval_number(self):33 with self.assertRaises(exceptions.ValidationError):34 self.update_service.write({'interval_number': -5})35 def test_onchange_service(self):36 new_service = self.env['currency.rate.update.service'].new(37 {'service': 'ECB'})38 new_service._onchange_service()39 self.assertEqual(len(new_service.currency_list), 2)40 def test_deactivate_update(self):41 before_message_count = len(self.update_service.message_ids)42 self.update_service.write({'interval_number': 0})43 self.assertEqual(before_message_count + 1,44 len(self.update_service.message_ids))45 def test_currency_rate_update_cron(self):46 self.update_service.next_run = fields.Date.today()47 self.env['currency.rate.update.service']._run_currency_update()48 self.update_service.refresh_currency()49 currency_rates = self.env['res.currency.rate'].search(50 [('currency_id', '=', self.currency.id)])51 self.assertTrue(currency_rates)52 def test_currency_rate_update_USD_EUR(self):53 self.env.user.company_id.currency_id = self.env.ref('base.USD')54 self.euro = self.env.ref('base.EUR')55 self.update_service.write({56 'currency_to_update': [(4, self.euro.id)]57 })58 currency_rates = self.env['res.currency.rate'].search(59 [('currency_id', '=', self.euro.id)])60 currency_rates.unlink()61 main_currency_rates = self.env['res.currency.rate'].search(62 [('currency_id', '=', self.env.user.company_id.currency_id.id)])63 main_currency_rates.unlink()64 self.update_service.refresh_currency()65 currency_rates = self.env['res.currency.rate'].search(66 [('currency_id', '=', self.euro.id)])67 self.assertTrue(currency_rates)68 def test_currency_rate_update_USD_CHF(self):69 self.env.user.company_id.currency_id = self.env.ref('base.USD')70 self.chf = self.env.ref('base.CHF')71 self.env.ref('base.CHF').active = True72 self.update_service.write({73 'currency_to_update': [(4, self.chf.id)]74 })75 currency_rates = self.env['res.currency.rate'].search(76 [('currency_id', '=', self.chf.id)])77 currency_rates.unlink()78 main_currency_rates = self.env['res.currency.rate'].search(79 [('currency_id', '=', self.env.user.company_id.currency_id.id)])80 main_currency_rates.unlink()81 self.update_service.refresh_currency()82 currency_rates = self.env['res.currency.rate'].search(83 [('currency_id', '=', self.chf.id)])...

Full Screen

Full Screen

updateServiceUtils.py

Source: updateServiceUtils.py Github

copy

Full Screen

1from app.defineTypes.CartCheckOuStatusType import CartCheckOuStatusType2from app.models import UpdateServiceStoreManager, Store, UpdateServiceDeliveryManager, DeliveryStore, Delivery3from app.utils.Utils import current_time_sec4def update_service_store_manager_product(store: Store):5 update_service, _ = UpdateServiceStoreManager.objects.get_or_create(6 store=store)7 update_service.product = current_time_sec()8 update_service.save()9def update_service_store_manager_message(store: Store):10 update_service, _ = UpdateServiceStoreManager.objects.get_or_create(11 store=store)12 update_service.message = current_time_sec()13 update_service.save()14def update_service_store_manager_order(cart_check_out_status_list: list, store: Store):15 update_service, _ = UpdateServiceStoreManager.objects.get_or_create(16 store=store)17 for cart_check_out_status in cart_check_out_status_list:18 if CartCheckOuStatusType.paymentWaiting == cart_check_out_status:19 update_service.orderNew = current_time_sec()20 update_service.orderPaymentWaiting = current_time_sec()21 elif CartCheckOuStatusType.checkWaiting == cart_check_out_status:22 update_service.orderNew = current_time_sec()23 update_service.orderCheckWaiting = current_time_sec()24 elif CartCheckOuStatusType.readyForSend == cart_check_out_status:25 update_service.orderReadyForSend = current_time_sec()26 elif CartCheckOuStatusType.sending == cart_check_out_status:27 update_service.orderSending = current_time_sec()28 elif CartCheckOuStatusType.delivered == cart_check_out_status:29 update_service.orderDelivered = current_time_sec()30 elif CartCheckOuStatusType.canceled == cart_check_out_status:31 update_service.orderCanceled = current_time_sec()32 update_service.save()33def update_service_delivery_order(delivery: Delivery, cart_check_out_status):34 update_service, _ = UpdateServiceDeliveryManager.objects.get_or_create(delivery=delivery)35 if cart_check_out_status == CartCheckOuStatusType.readyForSend:36 update_service.orderReadyForSend = current_time_sec()37 update_service.orderChange = current_time_sec()...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Rebuild Confidence in Your Test Automation

These days, development teams depend heavily on feedback from automated tests to evaluate the quality of the system they are working on.

What will come after “agile”?

I think that probably most development teams describe themselves as being “agile” and probably most development teams have standups, and meetings called retrospectives.There is also a lot of discussion about “agile”, much written about “agile”, and there are many presentations about “agile”. A question that is often asked is what comes after “agile”? Many testers work in “agile” teams so this question matters to us.

Test strategy and how to communicate it

I routinely come across test strategy documents when working with customers. They are lengthy—100 pages or more—and packed with monotonous text that is routinely reused from one project to another. Yawn once more— the test halt and resume circumstances, the defect management procedure, entrance and exit criteria, unnecessary generic risks, and in fact, one often-used model replicates the requirements of textbook testing, from stress to systems integration.

Do you possess the necessary characteristics to adopt an Agile testing mindset?

To understand the agile testing mindset, we first need to determine what makes a team “agile.” To me, an agile team continually focuses on becoming self-organized and cross-functional to be able to complete any challenge they may face during a project.

How To Refresh Page Using Selenium C# [Complete Tutorial]

When working on web automation with Selenium, I encountered scenarios where I needed to refresh pages from time to time. When does this happen? One scenario is that I needed to refresh the page to check that the data I expected to see was still available even after refreshing. Another possibility is to clear form data without going through each input individually.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful