コード例 #1
0
ファイル: tests_models.py プロジェクト: ar4s/ralph_assets
    def setUp(self):
        self.category = create_category()
        self.category.is_blade = True
        self.category.save()
        self.asset = create_asset(
            sn='1111-1111-1111-1111',
            invoice_date=datetime.date(2012, 11, 28),
            support_period=1,
            slots=12.0,
            price=100,
            deprecation_rate=100,
            category=self.category,
        )

        part_info = PartInfo(device=self.asset)
        part_info.save()
        self.asset2 = create_asset(
            sn='1111-1111-1111-11132',
            invoice_date=datetime.date(2012, 11, 28),
            support_period=1,
            slots=12.0,
            price=100,
            part_info=part_info,
            deprecation_rate=50,
            category=self.category,
        )
コード例 #2
0
    def setUp(self):
        self.category = create_category()
        self.category.is_blade = True
        self.category.save()
        self.asset = create_asset(
            sn='1111-1111-1111-1111',
            invoice_date=datetime.date(2012, 11, 28),
            support_period=1,
            slots=12.0,
            price=100,
            deprecation_rate=100,
            category=self.category,
        )

        part_info = PartInfo(device=self.asset)
        part_info.save()
        self.asset2 = create_asset(
            sn='1111-1111-1111-11132',
            invoice_date=datetime.date(2012, 11, 28),
            support_period=1,
            slots=12.0,
            price=100,
            part_info=part_info,
            deprecation_rate=50,
            category=self.category,
        )
コード例 #3
0
 def setUp(self):
     self.asset = create_asset(
         sn='1111-1111-1111-1111',
         invoice_date=datetime.date(2012, 11, 28),
         support_period=1,
         deprecation_rate=100,
     )
     self.asset2 = create_asset(
         sn='1111-1111-1111-1112',
         invoice_date=datetime.date(2012, 11, 28),
         support_period=120,
         deprecation_rate=50,
     )
コード例 #4
0
 def setUp(self):
     self.client = login_as_su()
     self.category = create_category()
     self.asset = create_asset(
         sn='1111-1111-1111-1111',
         category=self.category,
     )
     self.asset1 = create_asset(
         sn='2222-2222-2222-2222',
         category=self.category,
     )
     self.model = create_model()  # u'Model1'
     self.model1 = create_model(name='Model2')
コード例 #5
0
ファイル: tests_models.py プロジェクト: inc0/ralph_assets
 def setUp(self):
     self.asset = create_asset(
         sn='1111-1111-1111-1111',
         invoice_date=datetime.date(2012, 11, 28),
         support_period=1,
         deprecation_rate=100,
     )
     self.asset2 = create_asset(
         sn='1111-1111-1111-1112',
         invoice_date=datetime.date(2012, 11, 28),
         support_period=120,
         deprecation_rate=50,
     )
コード例 #6
0
    def setUp(self):
        self.client = login_as_su()

        self.first_asset = create_asset(
            request_date=datetime.date(2001, 1, 1),
            sn='1234-1234-1234-1234',
        )

        self.second_asset = create_asset(
            request_date=datetime.date(2002, 1, 1),
            sn='1235-1235-1235-1235',
        )

        self.third_asset = create_asset(
            request_date=datetime.date(2003, 1, 1),
            sn='1236-1236-1236-1236',
        )
コード例 #7
0
    def setUp(self):
        self.client = login_as_su()

        self.first_asset = create_asset(
            request_date=datetime.date(2001, 1, 1),
            sn='1234-1234-1234-1234',
        )

        self.second_asset = create_asset(
            request_date=datetime.date(2002, 1, 1),
            sn='1235-1235-1235-1235',
        )

        self.third_asset = create_asset(
            request_date=datetime.date(2003, 1, 1),
            sn='1236-1236-1236-1236',
        )
コード例 #8
0
    def setUp(self):
        self.client = login_as_su()
        self.category = create_category()
        self.first_asset = create_asset(sn="1234-1234-1234-1234", category=self.category)

        self.asset_with_duplicated_sn = create_asset(sn="1111-1111-1111-1111", category=self.category)

        # Prepare required fields (formset_name, field_name)
        self.required_fields = [
            ("asset_form", "model"),
            ("asset_form", "support_period"),
            ("asset_form", "support_type"),
            ("asset_form", "warehouse"),
            ("asset_form", "category"),
        ]

        self.model1 = create_model()
コード例 #9
0
 def setUp(self):
     self.asset = create_asset(
         sn='1111-1111-1111-1111',
         invoice_date=datetime.date(2012, 11, 28),
         support_period=1,
         slots=12.0,
         price=100,
     )
     part_info = PartInfo(device=self.asset)
     part_info.save()
     self.asset2 = create_asset(
         sn='1111-1111-1111-11132',
         invoice_date=datetime.date(2012, 11, 28),
         support_period=1,
         slots=12.0,
         price=100,
         part_info=part_info,
     )
コード例 #10
0
    def setUp(self):
        self.client = login_as_su()
        self.base_url = '/assets/dc/search'

        self.first_asset = create_asset(
            production_use_date=datetime.date(2001, 1, 1),
            sn='1234-1234-1234-1234',
        )

        self.second_asset = create_asset(
            production_use_date=datetime.date(2002, 1, 1),
            sn='1235-1235-1235-1235',
        )

        self.third_asset = create_asset(
            production_use_date=datetime.date(2003, 1, 1),
            sn='1236-1236-1236-1236',
        )
コード例 #11
0
    def setUp(self):
        self.client = login_as_su()
        self.base_url = '/assets/dc/search'

        self.first_asset = create_asset(
            production_use_date=datetime.date(2001, 1, 1),
            sn='1234-1234-1234-1234',
        )

        self.second_asset = create_asset(
            production_use_date=datetime.date(2002, 1, 1),
            sn='1235-1235-1235-1235',
        )

        self.third_asset = create_asset(
            production_use_date=datetime.date(2003, 1, 1),
            sn='1236-1236-1236-1236',
        )
コード例 #12
0
 def setUp(self):
     self.client = login_as_su()
     self.model = create_model()
     self.model2 = create_model('Model2')
     self.warehouse = create_warehouse()
     self.warehouse2 = create_warehouse('Warehouse2')
     self.category = create_category()
     self.asset = create_asset(sn='1111-1111-1111-1111',
                               category=self.category)
コード例 #13
0
ファイル: tests_models.py プロジェクト: inc0/ralph_assets
 def setUp(self):
     self.asset = create_asset(
         sn='1111-1111-1111-1111',
         invoice_date=datetime.date(2012, 11, 28),
         support_period=1,
         slots=12.0,
         price=100,
     )
     part_info = PartInfo(device=self.asset)
     part_info.save()
     self.asset2 = create_asset(
         sn='1111-1111-1111-11132',
         invoice_date=datetime.date(2012, 11, 28),
         support_period=1,
         slots=12.0,
         price=100,
         part_info=part_info,
     )
コード例 #14
0
ファイル: tests_other.py プロジェクト: quamilek/ralph_assets
    def setUp(self):
        self.user = User.objects.create_user('user', '*****@*****.**')
        self.user.is_staff = False
        self.user.is_superuser = False
        self.user.first_name = 'Elmer'
        self.user.last_name = 'Stevens'
        self.user.save()

        self.owner = User.objects.create_user('owner', '*****@*****.**')
        self.owner.is_staff = False
        self.owner.is_superuser = False
        self.owner.first_name = 'Eric'
        self.owner.last_name = 'Brown'
        self.owner.save()

        self.category = create_category()
        self.model = create_model(category=self.category)
        self.asset = create_asset(
            sn='1111-1111-1111-1111',
            model=self.model,
            user=self.user,
            owner=self.owner,
            barcode='br-666',
            niw='niw=666',
        )

        self.software_category = SoftwareCategory(
            name='soft-cat1', asset_type=AssetType.DC
        )
        self.software_category.save()

        self.manufacturer = AssetManufacturer(name='test_manufacturer')
        self.manufacturer.save()

        self.licence_type = LicenceType(name='test_licence_type')
        self.licence_type.save()

        self.property_of = AssetOwner(name="test_property")
        self.property_of.save()

        self.licence1 = Licence(
            licence_type=self.licence_type,
            software_category=self.software_category,
            manufacturer=self.manufacturer,
            property_of=self.property_of,
            number_bought=10,
            sn="test-sn",
            niw="niw-666",
            invoice_date=datetime.date(2014, 4, 28),
            invoice_no="666-999-666",
            price=1000.0,
            provider="test_provider",
            asset_type=AssetType.DC,
        )
        self.licence1.save()
コード例 #15
0
    def setUp(self):
        self.client = login_as_su()
        self.category = create_category()
        self.first_asset = create_asset(
            invoice_date=datetime.date(2001, 1, 1),
            sn='1234-1234-1234-1234',
            category=self.category,
        )

        self.second_asset = create_asset(
            invoice_date=datetime.date(2002, 1, 1),
            sn='1235-1235-1235-1235',
            category=self.category,
        )

        self.third_asset = create_asset(
            invoice_date=datetime.date(2003, 1, 1),
            sn='1236-1236-1236-1236',
            category=self.category,
        )
コード例 #16
0
ファイル: tests_crud.py プロジェクト: ar4s/ralph_assets
 def setUp(self):
     self.client = login_as_su()
     self.model = create_model()
     self.model2 = create_model('Model2')
     self.warehouse = create_warehouse()
     self.warehouse2 = create_warehouse('Warehouse2')
     self.category = create_category()
     self.asset = create_asset(
         sn='1111-1111-1111-1111',
         category=self.category
     )
コード例 #17
0
ファイル: tests_other.py プロジェクト: efigence/ralph_assets
    def setUp(self):
        self.user = User.objects.create_user('user', '*****@*****.**')
        self.user.is_staff = False
        self.user.is_superuser = False
        self.user.first_name = 'Elmer'
        self.user.last_name = 'Stevens'
        self.user.save()

        self.owner = User.objects.create_user('owner', '*****@*****.**')
        self.owner.is_staff = False
        self.owner.is_superuser = False
        self.owner.first_name = 'Eric'
        self.owner.last_name = 'Brown'
        self.owner.save()

        self.category = create_category()
        self.model = create_model(category=self.category)
        self.asset = create_asset(
            sn='1111-1111-1111-1111',
            model=self.model,
            user=self.user,
            owner=self.owner,
            barcode='br-666',
            niw='niw=666',
        )

        self.software_category = SoftwareCategory(
            name='soft-cat1', asset_type=models_assets.AssetType.DC)
        self.software_category.save()

        self.manufacturer = AssetManufacturer(name='test_manufacturer')
        self.manufacturer.save()

        self.licence_type = LicenceType(name='test_licence_type')
        self.licence_type.save()

        self.property_of = AssetOwner(name="test_property")
        self.property_of.save()

        self.licence1 = Licence(
            licence_type=self.licence_type,
            software_category=self.software_category,
            manufacturer=self.manufacturer,
            property_of=self.property_of,
            number_bought=10,
            sn="test-sn",
            niw="niw-666",
            invoice_date=datetime.date(2014, 4, 28),
            invoice_no="666-999-666",
            price=1000.0,
            provider="test_provider",
            asset_type=models_assets.AssetType.DC,
        )
        self.licence1.save()
コード例 #18
0
    def setUp(self):
        self.client = login_as_su()
        self.category = create_category()
        self.first_asset = create_asset(
            invoice_date=datetime.date(2001, 1, 1),
            sn='1234-1234-1234-1234',
            category=self.category,
        )

        self.second_asset = create_asset(
            invoice_date=datetime.date(2002, 1, 1),
            sn='1235-1235-1235-1235',
            category=self.category,
        )

        self.third_asset = create_asset(
            invoice_date=datetime.date(2003, 1, 1),
            sn='1236-1236-1236-1236',
            category=self.category,
        )
コード例 #19
0
 def setUp(self):
     self.client = login_as_su()
     self.category = create_category()
     asset_fields = dict(
         barcode='123456789',
         invoice_no='Invoice #1',
         order_no='Order #1',
         invoice_date=datetime.date(2001, 1, 1),
         sn='0000-0000-0000-0000',
         category=self.category,
     )
     self.asset = create_asset(**asset_fields)
コード例 #20
0
 def setUp(self):
     self.client = login_as_su()
     self.category = create_category()
     asset_fields = dict(
         barcode='123456789',
         invoice_no='Invoice #1',
         order_no='Order #1',
         invoice_date=datetime.date(2001, 1, 1),
         sn='0000-0000-0000-0000',
         category=self.category,
     )
     self.asset = create_asset(**asset_fields)
コード例 #21
0
ファイル: tests_models.py プロジェクト: ar4s/ralph_assets
 def setUp(self):
     self.asset = create_asset(
         sn='1111-1111-1111-1111',
         invoice_date=datetime.date(2012, 11, 28),
         support_period=1,
         deprecation_rate=100,
     )
     self.asset.device_info.ralph_device_id = 666
     self.asset.device_info.save()
     self.asset2 = create_asset(
         sn='1111-1111-1111-1112',
         invoice_date=datetime.date(2012, 11, 28),
         support_period=120,
         deprecation_rate=50,
     )
     self.asset2.device_info.ralph_device_id = 667
     self.asset2.device_info.save()
     self.asset3 = create_asset(
         sn='1111-1111-1111-1113',
         invoice_date=datetime.date(2012, 11, 28),
         support_period=120,
         deprecation_rate=50,
         force_deprecation=True,
     )
     dev1 = Device.create(
         [('1', 'sda', 0)],
         model_name='xxx',
         model_type=DeviceType.rack_server,
         allow_stub=1,
     )
     dev1.id = 666
     dev1.save()
     dev2 = Device.create(
         [('1', 'dawdwad', 0)],
         model_name='Unknown',
         model_type=DeviceType.unknown,
         allow_stub=1,
     )
     dev2.id = 667
     dev2.save()
コード例 #22
0
 def setUp(self):
     self.asset = create_asset(
         sn='1111-1111-1111-1111',
         invoice_date=datetime.date(2012, 11, 28),
         support_period=1,
         deprecation_rate=100,
     )
     self.asset.device_info.ralph_device_id = 666
     self.asset.device_info.save()
     self.asset2 = create_asset(
         sn='1111-1111-1111-1112',
         invoice_date=datetime.date(2012, 11, 28),
         support_period=120,
         deprecation_rate=50,
     )
     self.asset2.device_info.ralph_device_id = 667
     self.asset2.device_info.save()
     self.asset3 = create_asset(
         sn='1111-1111-1111-1113',
         invoice_date=datetime.date(2012, 11, 28),
         support_period=120,
         deprecation_rate=50,
         force_deprecation=True,
     )
     dev1 = Device.create(
         [('1', 'sda', 0)],
         model_name='xxx',
         model_type=DeviceType.rack_server,
         allow_stub=1,
     )
     dev1.id = 666
     dev1.save()
     dev2 = Device.create(
         [('1', 'dawdwad', 0)],
         model_name='Unknown',
         model_type=DeviceType.unknown,
         allow_stub=1,
     )
     dev2.id = 667
     dev2.save()
コード例 #23
0
    def setUp(self):
        self.client = login_as_su()
        self.category = create_category()
        self.first_asset = create_asset(
            invoice_no='Invoice No1',
            order_no='Order No2',
            invoice_date=datetime.date(2001, 1, 1),
            support_type='Support d2d',
            provider='Provider1',
            sn='1234-1234-1234-1234',
            barcode='bc1',
            category=self.category,
        )

        self.second_asset = create_asset(
            invoice_no='Invoice No2',
            order_no='Order No1',
            invoice_date=datetime.date(2001, 1, 1),
            support_type='Support d2d',
            provider='Provider2',
            sn='1235-1235-1235-1235',
            barcode='bc2',
            category=self.category,
        )

        asset_model = create_model(name='Model2')
        asset_status = AssetStatus.used.id
        self.third_asset = create_asset(
            model=asset_model,
            invoice_no='Invoice No1',
            order_no='Order No1',
            invoice_date=datetime.date(2001, 1, 1),
            support_type='Support d2d',
            provider='Provider1',
            sn='1236-1236-1236-1236',
            barcode='bc3',
            status=asset_status,
            category=self.category,
        )
コード例 #24
0
    def setUp(self):
        self.client = login_as_su()
        self.category = create_category()
        self.first_asset = create_asset(
            invoice_no='Invoice No1',
            order_no='Order No2',
            invoice_date=datetime.date(2001, 1, 1),
            support_type='Support d2d',
            provider='Provider1',
            sn='1234-1234-1234-1234',
            barcode='bc1',
            category=self.category,
        )

        self.second_asset = create_asset(
            invoice_no='Invoice No2',
            order_no='Order No1',
            invoice_date=datetime.date(2001, 1, 1),
            support_type='Support d2d',
            provider='Provider2',
            sn='1235-1235-1235-1235',
            barcode='bc2',
            category=self.category,
        )

        asset_model = create_model(name='Model2')
        asset_status = AssetStatus.used.id
        self.third_asset = create_asset(
            model=asset_model,
            invoice_no='Invoice No1',
            order_no='Order No1',
            invoice_date=datetime.date(2001, 1, 1),
            support_type='Support d2d',
            provider='Provider1',
            sn='1236-1236-1236-1236',
            barcode='bc3',
            status=asset_status,
            category=self.category,
        )
コード例 #25
0
    def setUp(self):
        self.client = login_as_su()
        self.category = create_category()
        self.first_asset = create_asset(
            sn='1234-1234-1234-1234',
            category=self.category,
        )

        self.asset_with_duplicated_sn = create_asset(
            sn='1111-1111-1111-1111',
            category=self.category,
        )

        # Prepare required fields (formset_name, field_name)
        self.required_fields = [
            ('asset_form', 'model'),
            ('asset_form', 'support_period'),
            ('asset_form', 'support_type'),
            ('asset_form', 'warehouse'),
            ('asset_form', 'category'),
        ]

        self.model1 = create_model()
コード例 #26
0
    def setUp(self):
        self.category = AssetCategory.objects.get(name="Blade System")
        self.model = create_model(
            category=self.category
        )
        self.model2 = create_model(
            'Model2',
            category=self.category,
        )
        self.warehouse = create_warehouse()
        self.asset = create_asset(
            sn='1111-1111-1111-1111'
        )
        self.asset_id = self.asset.id
        self.asset.device_info.ralph_device_id = 666
        self.asset.device_info.save()

        self.asset_data_raw = {
            u'asset_id': 1,
            u'barcode': None,
            u'category': u'Blade System',
            u'delivery_date': None,
            u'deprecation_rate': 25,
            u'invoice_date': None,
            u'invoice_no': None,
            u'is_deprecated': True,
            u'manufacturer': u'Manufacturer1',
            u'model': u'Model1',
            u'niw': None,
            u'order_no': None,
            u'price': 0,
            u'production_use_date': None,
            u'provider': None,
            u'provider_order_date': None,
            u'rack': None,
            u'remarks': u'',
            u'request_date': None,
            u'size': 0,
            u'slots': 0.0,
            u'sn': u'1111-1111-1111-1111',
            u'source': u'shipment',
            u'status': u'new',
            u'support_period': 24,
            u'support_price': None,
            u'support_type': u'standard',
            u'support_void_reporting': True,
            u'u_height': None,
            u'u_level': None,
            u'warehouse': u'Warehouse',
        }
コード例 #27
0
    def setUp(self):
        self.client = login_as_su()
        self.category = create_category()
        self.first_asset = create_asset(
            sn='1234-1234-1234-1234',
            category=self.category,
        )

        self.asset_with_duplicated_sn = create_asset(
            sn='1111-1111-1111-1111',
            category=self.category,
        )

        # Prepare required fields (formset_name, field_name)
        self.required_fields = [
            ('asset_form', 'model'),
            ('asset_form', 'support_period'),
            ('asset_form', 'support_type'),
            ('asset_form', 'warehouse'),
            ('asset_form', 'category'),
        ]

        self.model1 = create_model()