Beispiel #1
0
    def setUp(self):
        super().setUp()
        self.category = CategoryFactory()
        self.client_1 = ClientFactory()
        AccountFactory.create(user=self.user, client=self.client_1)
        self.product_1, self.product_2 = ProductFactory.create_batch(2, category=self.category)
        self.feature_1 = FeatureFactory(name='Wireless', product=self.product_2,
                                        shared_image=SharedImageFactory(image=ImageField(filename='wireless.jpg')))
        self.feature_2, self.feature_3 = FeatureFactory.create_batch(2, product=self.product_2)
        price_1 = ClientPriceFactory(client=self.client_1, product=self.product_1, unit_cost=200, system_cost=300)
        price_2 = ClientPriceFactory(client=self.client_1, product=self.product_2, unit_cost=250, system_cost=300)
        ClientPriceFactory(client=self.client_1, unit_cost=250, system_cost=300,
                           product=ProductFactory(enabled=False),)
        self.discount_1 = DiscountFactory(
            client_price=price_1, discount_type=VALUE_DISCOUNT, value=50, name='CCO', order=1, percent=0,
            apply_type=ON_DOCTOR_ORDER, cost_type=UNIT_COST,
            shared_image=SharedImageFactory(image=ImageField(filename='CCO.png'))
        )
        self.discount_2 = DiscountFactory(
            client_price=price_2, discount_type=PERCENT_DISCOUNT, percent=10, cost_type=SYSTEM_COST, order=2,
            apply_type=ON_DOCTOR_ORDER, name='Repless',
            shared_image=SharedImageFactory(image=ImageField(filename='repless.png'))
        )
        self.discount_3 = DiscountFactory(
            client_price=price_1, discount_type=PERCENT_DISCOUNT, value=0, name='Bulk', order=2, percent=15,
            apply_type=PRE_DOCTOR_ORDER, cost_type=UNIT_COST, shared_image=None)
        device = self.client_1.device_set.get(product=self.product_1)
        ItemFactory(device=device, discounts=[self.discount_3], purchase_type=BULK_PURCHASE, is_used=False,
                    cost_type=UNIT_COST)

        self.path = reverse('api:hospital:device:products', args=(self.client_1.id, self.category.id,))
Beispiel #2
0
 def setUp(self):
     super().setUp()
     self.category_1, self.category_2 = CategoryFactory.create_batch(2)
     self.client_1, self.client_2 = ClientFactory.create_batch(2)
     self.user.default_client = self.client_1
     self.user.save()
     self.path = reverse('api:hospital:device:categories', args=(self.client_1.id,))
     self.account_1 = AccountFactory.create(user=self.user, client=self.client_1)
     self.account_2 = AccountFactory.create(user=self.user, client=self.client_2)
     ClientPriceFactory(client=self.client_1, product=ProductFactory(category=self.category_1))
     ClientPriceFactory(client=self.client_1, product=ProductFactory(category=self.category_2))
     ClientPriceFactory(client=self.client_2, product=ProductFactory(category=self.category_1))
     ClientPriceFactory.create_batch(3)
Beispiel #3
0
    def setUp(self):
        super().setUp()
        specialty = SpecialtyFactory()
        self.account = AccountFactory.create(
            role=RoleFactory(priority=RolePriority.PHYSICIAN.value),
            user=self.user,
            specialties=(specialty, ))
        self.account_foo = AccountFactory.create(user=self.account.user,
                                                 specialties=(specialty, ))

        self.category_1 = CategoryFactory(specialty=specialty)
        self.category_2 = CategoryFactory(specialty=specialty)

        faker = Faker()
        self.category_1_orders = faker.random_int(min=1, max=20)
        self.category_2_orders = faker.random_int(min=1, max=20)
        self.other_orders = faker.random_int(min=1, max=20)
        self.total_num_orders = self.category_1_orders + self.category_2_orders + self.other_orders
        OrderFactory.create_batch(
            self.category_1_orders,
            physician=self.account,
            product=ProductFactory(category=self.category_1))
        OrderFactory.create_batch(
            self.category_2_orders,
            physician=self.account,
            product=ProductFactory(category=self.category_2))
        OrderFactory.create_batch(
            self.other_orders,
            physician=AccountFactory(client=self.account.client),
            product=ProductFactory(category=self.category_2))
        OrderFactory.create_batch(
            3,
            physician=self.account_foo,
            product=ProductFactory(category=self.category_1))

        self.path = reverse('api:hospital:order:ordersummary',
                            args=(self.account.client.id, ))
Beispiel #4
0
    def setUp(self):
        super().setUp()
        specialty = SpecialtyFactory()
        self.account = AccountFactory.create(
            role=RoleFactory(priority=RolePriority.PHYSICIAN.value),
            user=self.user,
            specialties=(specialty, ))

        self.category_1 = CategoryFactory(specialty=specialty)
        self.category_2 = CategoryFactory(specialty=specialty)
        self.manufacturer_1 = ManufacturerFactory(image=ImageField(
            filename='Abbott.jpg'))
        self.manufacturer_2 = ManufacturerFactory(image=ImageField(
            filename='Simon.jpg'))
        self.product_1 = ProductFactory(category=self.category_1,
                                        manufacturer=self.manufacturer_1)
        self.product_2 = ProductFactory(category=self.category_2,
                                        manufacturer=self.manufacturer_2)
        self.product_3 = ProductFactory(category=self.category_1,
                                        manufacturer=self.manufacturer_2)

        faker = Faker()
        self.product_1_orders = faker.random_int(min=1, max=5)
        self.category_2_orders = faker.random_int(min=1, max=4)
        self.other_orders = faker.random_int(min=1, max=3)
        self.total_num_orders = self.product_1_orders + self.category_2_orders + self.other_orders
        OrderFactory.create_batch(self.product_1_orders,
                                  physician=self.account,
                                  product=self.product_1)
        OrderFactory.create_batch(self.category_2_orders,
                                  physician=self.account,
                                  product=self.product_2)
        OrderFactory.create_batch(
            self.other_orders,
            physician=AccountFactory(client=self.account.client),
            product=self.product_3)
        self.path = reverse('api:hospital:order:ordersummary_by_category',
                            args=(self.account.client.id, self.category_1.id))