Example #1
0
 def setUp(self):
     super().setUp()
     self.specialty = SpecialtyFactory()
     self.category_1, self.category_2 = CategoryFactory.create_batch(2, specialty=self.specialty)
     self.log_in_master_admin()
     self.visit_reverse('admin:device_category_add')
     self.wait_for_element_contains_text('.model-category.change-form #content h1', 'Add category')
Example #2
0
 def setUp(self):
     super().setUp()
     client = ClientFactory(name='UVMC')
     specialty = SpecialtyFactory(name='CDM')
     category = CategoryFactory(name='Pacemaker', specialty=specialty)
     PreferenceFactory(name='Default for all products',
                       client=None,
                       content_type=None,
                       object_id=None,
                       questions=[QuestionFactory(name='Longevity')])
     PreferenceFactory(name='Preferences for client',
                       client=client,
                       content_type=None,
                       object_id=None,
                       questions=[QuestionFactory(name='Size/shape')])
     PreferenceFactory(name='Preferences for client:specialty',
                       client=client,
                       object_id=specialty.id,
                       content_type=ContentType.objects.get(
                           app_label='device', model='specialty'),
                       questions=[QuestionFactory(name='Research')])
     PreferenceFactory(name='Preferences for client:category',
                       client=client,
                       object_id=category.id,
                       content_type=ContentType.objects.get(
                           app_label='device', model='category'),
                       questions=[QuestionFactory(name='cost')])
     self.log_in_master_admin()
     self.visit_reverse('admin:order_preference_changelist')
     self.wait_for_element_contains_text('.model-preference #content h1',
                                         'Select preference to change')
Example #3
0
    def test_rebatable_items(self):
        for model_name in ['product', 'category', 'specialty']:
            self.assertCountEqual(
                self.manufacturer.rebatable_items(model_name), [])

        specialty_1, specialty_2 = SpecialtyFactory.create_batch(2)
        category_1 = CategoryFactory(specialty=specialty_1)
        category_2, category_3 = CategoryFactory.create_batch(
            2, specialty=specialty_2)
        product_1 = ProductFactory(category=category_1,
                                   manufacturer=self.manufacturer)
        product_2 = ProductFactory(category=category_2,
                                   manufacturer=self.manufacturer)
        product_3 = ProductFactory(category=category_3,
                                   manufacturer=self.manufacturer)
        product_4 = ProductFactory(category=category_1,
                                   manufacturer=self.manufacturer)
        ProductFactory(category=category_3)

        self.assertCountEqual(self.manufacturer.rebatable_items('specialty'),
                              [specialty_1, specialty_2])
        self.assertCountEqual(self.manufacturer.rebatable_items('category'),
                              [category_1, category_2, category_3])
        self.assertCountEqual(self.manufacturer.rebatable_items('product'),
                              [product_1, product_2, product_3, product_4])
        self.assertCountEqual(
            self.manufacturer.rebatable_items('manufacturer'), [])
Example #4
0
    def setUp(self):
        super(ProductAdminTestCase, self).setUp()
        self.log_in_master_admin()
        self.specialty = SpecialtyFactory(name='Cardiac Rhythm Management')
        CategoryFactory.create_batch(2, specialty=self.specialty)

        self.product_1, self.product_2 = ProductFactory.create_batch(2, model_number='1456Q-86')
        ProductFactory.create_batch(3)
Example #5
0
 def setUp(self):
     super(AccountsInlineAdminTestCase, self).setUp()
     self.log_in_master_admin()
     self.client = ClientFactory(name='NS Global')
     self.client2 = ClientFactory(name='NS Vietnam')
     self.role = RoleFactory(name='Physician')
     self.user1 = UserFactory(email='*****@*****.**')
     self.user2 = UserFactory(email='*****@*****.**')
     self.specialty_1, self.specialty_2 = SpecialtyFactory.create_batch(2)
Example #6
0
 def setUp(self):
     super().setUp()
     self.log_in_master_admin()
     self.specialty = SpecialtyFactory(name='Cardiac Rhythm Management')
     self.client = ClientFactory()
     category = CategoryFactory(specialty=self.specialty)
     product = ProductFactory(category=category)
     DeviceFactory(client=self.client)
     ClientPriceFactory(client=self.client, product=product)
Example #7
0
    def setUp(self):
        super(FilterClientsByDevicesAdminTestCase, self).setUp()
        self.client1 = ClientFactory(name='NS Global')
        self.client2 = ClientFactory(name='NS Vietnam')
        self.client3 = ClientFactory(name='International hospital')

        specialty = SpecialtyFactory(name='Structural Heart')
        specialty2 = SpecialtyFactory(name='Interventional Cardiology')
        SpecialtyFactory(name='Neuromodulation')

        self._create_product_for_client(product='LINQ', category='TAVR Delivery System',
                                        specialty=specialty, client=self.client3)
        self._create_product_for_client(product='Pacemaker', category='TAVR Implant System',
                                        specialty=specialty, client=self.client2)
        self._create_product_for_client(product='Assurity', category='​Drug Eluting Stents',
                                        specialty=specialty2, client=self.client1)

        self.log_in_master_admin()
        self.visit_reverse('admin:hospital_client_changelist')
        self.wait_for_element_contains_text('.model-client.change-list #content h1', 'Select client to change')
Example #8
0
    def test_devices_by_specialties(self):
        specialty1, specialty2 = SpecialtyFactory.create_batch(2)
        category1 = CategoryFactory(specialty=specialty1)
        category2, category3 = CategoryFactory.create_batch(2, specialty=specialty2)
        product1 = DeviceFactory(client=self.client, product=ProductFactory(name='Device1', category=category1)).product
        product2 = DeviceFactory(client=self.client, product=ProductFactory(name='Device2', category=category2)).product
        product3 = DeviceFactory(client=self.client, product=ProductFactory(name='Device3', category=category3)).product

        self.assertDictEqual(self.client.devices_by_specialties(), {
            specialty1.id: {'name': specialty1.name, 'products': [(product1.id, product1.name)]},
            specialty2.id: {'name': specialty2.name, 'products': [(product2.id, product2.name),
                                                                  (product3.id, product3.name)]}
        })
Example #9
0
 def test_to_string(self):
     self.assertEqual(
         str(
             RebatableItemFactory(content_object=ProductFactory(
                 name='Entrosa'))), 'product: Entrosa')
     self.assertEqual(
         str(
             RebatableItemFactory(content_object=CategoryFactory(
                 name='CRT-D'))), 'category: CRT-D')
     self.assertEqual(
         str(
             RebatableItemFactory(content_object=SpecialtyFactory(
                 name='IH'))), 'specialty: IH')
Example #10
0
    def test_show_list_of_categories(self):
        self.log_in_master_admin()
        self.specialty, specialty = SpecialtyFactory.create_batch(2)
        self.category = CategoryFactory(name='Total Knee System', specialty=self.specialty)
        CategoryFactory.create_batch(2, specialty=specialty)
        ProductFactory.create_batch(3, category=self.category)

        self.visit_reverse('admin:device_specialty_changelist')
        self.wait_for_element_contains_text('#content h1', 'Select specialty to change')
        self.assert_elements_count('#result_list tbody tr', count=2)

        self.find_link(self.specialty.name).click()
        self.wait_for_element_contains_text('#content h1', 'Select category to change')
        self.assert_elements_count('#result_list tbody tr', count=1)
        self.wait_for_element_contains_text('#result_list tbody tr', 'Total Knee System')

        self.find_link(self.category.name).click()
        self.wait_for_element_contains_text('#content h1', 'Select product to change')
        self.assert_elements_count('#result_list tbody tr', count=3)
Example #11
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))
Example #12
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, ))
Example #13
0
    def test_product_ids(self):
        specialty = SpecialtyFactory()
        category_1, category_2 = CategoryFactory.create_batch(
            2, specialty=specialty)
        product_1, product_2 = ProductFactory.create_batch(2,
                                                           category=category_1)
        product_3, product_4 = ProductFactory.create_batch(2,
                                                           category=category_2)

        self.assertCountEqual(
            RebatableItemFactory(content_object=product_1).product_ids,
            [product_1.id])
        self.assertCountEqual(
            RebatableItemFactory(content_object=category_1).product_ids,
            [product_1.id, product_2.id])
        self.assertCountEqual(
            RebatableItemFactory(content_object=category_2).product_ids,
            [product_3.id, product_4.id])
        self.assertCountEqual(
            RebatableItemFactory(content_object=specialty).product_ids,
            [product_1.id, product_2.id, product_3.id, product_4.id])
        self.assertCountEqual(
            RebatableItemFactory(content_object=ClientFactory()).product_ids,
            [])
Example #14
0
 def add_specialty_with_categories(self, name, categories):
     specialty = SpecialtyFactory(name=name)
     for category in categories:
         CategoryFactory(name=category, specialty=specialty)
Example #15
0
 def setUp(self):
     self.specialty = SpecialtyFactory(name='Structural Heart')
     self.product = ProductFactory(category=CategoryFactory(
         specialty=self.specialty))
Example #16
0
 def test_to_string_returns_specialty_name(self):
     specialty = SpecialtyFactory()
     self.assertEqual(str(specialty), specialty.name)
Example #17
0
 def setUp(self):
     self.client = ClientFactory(name='UVMCdemo')
     specialty = SpecialtyFactory(name='Cardiac Rhythm Management')
     self.category = CategoryFactory(name='DDD Pacemakers',
                                     specialty=specialty)
Example #18
0
 def test_unique_specialty_name(self):
     specialty = SpecialtyFactory()
     self.assertRaises(IntegrityError,
                       Specialty.objects.create,
                       name=specialty.name)