コード例 #1
0
ファイル: tests_models.py プロジェクト: inc0/ralph_assets
 def tests_api_asset(self):
     for item in get_assets():
         self.assertEqual(item['asset_id'], self.asset.id)
         self.assertEqual(
             item['ralph_id'], self.asset.device_info.ralph_device_id,
         )
         self.assertEqual(item['slots'], self.asset.slots)
         self.assertEqual(item['price'], self.asset.price)
         self.assertEqual(item['is_deprecated'], self.asset.is_deprecated())
         self.assertEqual(item['sn'], self.asset.sn)
         self.assertEqual(item['barcode'], self.asset.barcode)
コード例 #2
0
 def tests_api_asset(self):
     for item in get_assets():
         self.assertEqual(item['asset_id'], self.asset.id)
         self.assertEqual(
             item['ralph_id'], self.asset.device_info.ralph_device_id,
         )
         self.assertEqual(item['slots'], self.asset.slots)
         self.assertEqual(item['price'], self.asset.price)
         self.assertEqual(item['is_deprecated'], self.asset.is_deprecated())
         self.assertEqual(item['sn'], self.asset.sn)
         self.assertEqual(item['barcode'], self.asset.barcode)
コード例 #3
0
ファイル: tests_models.py プロジェクト: mkurek/ralph_assets
 def tests_api_asset(self):
     date = datetime.date(2014, 03, 29)
     for item in get_assets(date):
         self.assertEqual(item['asset_id'], self.asset.id)
         self.assertEqual(
             item['ralph_id'], self.asset.device_info.ralph_device_id,
         )
         self.assertEqual(item['slots'], self.asset.slots)
         self.assertEqual(item['price'], self.asset.price)
         self.assertEqual(
             item['is_deprecated'],
             self.asset.is_deprecated(date)
         )
         self.assertEqual(item['sn'], self.asset.sn)
         self.assertEqual(item['barcode'], self.asset.barcode)
コード例 #4
0
 def tests_api_asset(self):
     date = datetime.date(2014, 03, 29)
     for item in get_assets(date):
         self.assertEqual(item['asset_id'], self.asset.id)
         self.assertEqual(
             item['ralph_id'],
             self.asset.device_info.ralph_device_id,
         )
         self.assertEqual(item['slots'], self.asset.slots)
         self.assertEqual(item['price'], self.asset.price)
         self.assertEqual(item['is_deprecated'],
                          self.asset.is_deprecated(date))
         self.assertEqual(item['sn'], self.asset.sn)
         self.assertEqual(item['barcode'], self.asset.barcode)
         self.assertEqual(item['venture_id'], self.stock_venture.id)
         self.assertEqual(item['is_blade'], self.category.is_blade)
         self.assertEqual(item['cores_count'], self.asset.cores_count)
コード例 #5
0
def assets(**kwargs):
    """Updates the devices from Ralph Assets."""

    date = kwargs['today']
    usages = {
        'core': get_core_usage(),
        'power_consumption': get_power_consumption_usage(),
        'collocation': get_collocation_usage(),
    }

    new_assets = total = 0
    for data in get_assets(date):
        if update_assets(
                data,
                date,
                usages,
        ):
            new_assets += 1
        total += 1
    return True, '%d new assets, %d total' % (new_assets, total), kwargs
コード例 #6
0
ファイル: assets.py プロジェクト: ar4s/ralph_pricing
def assets(**kwargs):
    """Updates the devices from Ralph Assets."""

    date = kwargs['today']
    usages = {
        'core': get_core_usage(),
        'power_consumption': get_power_consumption_usage(),
        'collocation': get_collocation_usage(),
    }

    new_assets = total = 0
    for data in get_assets(date):
        if update_assets(
            data,
            date,
            usages,
        ):
            new_assets += 1
        total += 1
    return True, '%d new assets, %d total' % (new_assets, total), kwargs
コード例 #7
0
def assets(**kwargs):
    """Updates the devices from Ralph Assets."""

    date = kwargs['today']
    count = sum(update_assets(data, date) for data in get_assets())
    return True, '%d new devices' % count, kwargs
コード例 #8
0
def assets(**kwargs):
    """Updates the devices from Ralph Assets."""

    date = kwargs['today']
    count = sum(update_assets(data, date) for data in get_assets())
    return True, '%d new devices' % count, kwargs