def test_create_order(self): from orders_manager.utils.generate_data_helper import populate_database from orders_manager.roles import init_roles init_roles() populate_database(skipped_items=('orders', )) order = Order.objects.create(**self.order_info) self.assertEqual(12, len(order.code)) self.assertEqual(self.order_info.get('author_id'), order.author.user.id) self.assertEqual(self.order_info.get('client_id'), order.client.id) self.assertEqual(len(self.order_info.get('client_children_id')), len(order.client_children.all())) self.assertEqual(self.order_info.get('celebrate_date'), order.celebrate_date) self.assertEqual(self.order_info.get('celebrate_time'), order.celebrate_time) self.assertEqual(self.order_info.get('celebrate_place'), order.celebrate_place) self.assertEqual(self.order_info.get('address'), order.address) self.assertEqual(self.order_info.get('program_id'), order.program.id) self.assertEqual(self.order_info.get('duration'), order.duration) self.assertEqual(self.order_info.get('price'), order.price) self.assertEqual(self.order_info.get('details'), order.details) self.assertEqual(self.order_info.get('executor_comment'), order.executor_comment) self.assertEqual(self.order_info.get('discount_id'), order.discount.id) self.assertEqual(self.order_info.get('total_price'), order.total_price) self.assertEqual(self.order_info.get('total_price_with_discounts'), order.total_price_with_discounts) order_services = order.additional_services_executors.all() for i in order_services: print('dunya')
def test_create_order(self): from orders_manager.utils.generate_data_helper import populate_database from orders_manager.roles import init_roles init_roles() populate_database(skipped_items=('orders',)) order = Order.objects.create(**self.order_info) self.assertEqual(12, len(order.code)) self.assertEqual(self.order_info.get('author_id'), order.author.user.id) self.assertEqual(self.order_info.get('client_id'), order.client.id) self.assertEqual(len(self.order_info.get('client_children_id')), len(order.client_children.all())) self.assertEqual(self.order_info.get('celebrate_date'), order.celebrate_date) self.assertEqual(self.order_info.get('celebrate_time'), order.celebrate_time) self.assertEqual(self.order_info.get('celebrate_place'), order.celebrate_place) self.assertEqual(self.order_info.get('address'), order.address) self.assertEqual(self.order_info.get('program_id'), order.program.id) self.assertEqual(self.order_info.get('duration'), order.duration) self.assertEqual(self.order_info.get('price'), order.price) self.assertEqual(self.order_info.get('details'), order.details) self.assertEqual(self.order_info.get('executor_comment'), order.executor_comment) self.assertEqual(self.order_info.get('discount_id'), order.discount.id) self.assertEqual(self.order_info.get('total_price'), order.total_price) self.assertEqual(self.order_info.get('total_price_with_discounts'), order.total_price_with_discounts) order_services = order.additional_services_executors.all() for i in order_services: print('dunya')
def get(self, request, *args, **kwargs): from orders_manager.utils.generate_data_helper import populate_database from orders_manager.roles import init_roles init_roles() User.objects.create_superuser('admin', '*****@*****.**', '12345') Discount.objects.create(name='Нет скидки', value=0) populate_database() return HttpResponse('Done')
def set_up(self): from orders_manager.utils.generate_data_helper import populate_database from orders_manager.roles import init_roles init_roles() populate_database()
def set_up(self): from orders_manager.utils.generate_data_helper import populate_database from orders_manager.roles import init_roles init_roles() populate_database()