Exemplo n.º 1
0
def main():
    SpliceServer.drop_collection()
    ProductUsage.drop_collection()
    ReportData.drop_collection()
    ss1 = TestData.create_splice_server("test01", "east")
    
    uuid_rhel_jboss = products_dict[RHEL][1]
    prod_rhel = products_dict[RHEL][0]
    prod_jboss = products_dict[JBoss][0]
    
    uuid_ha = products_dict[HA][1]
    prod_ha = products_dict[HA][0]
    
    uuid_edu = products_dict[EDU][1]
    prod_edu = products_dict[EDU][0]
    
    now = datetime.now()
    delta_day = timedelta(days=4)
    delta_hour = timedelta(days=3)
    
    
    for i in range(1, 10):
        this_time = now - (delta_hour * i)
        create_set_of_usage(
            prod_rhel, uuid_rhel_jboss, get_times(this_time), ss1, 7)
    
    for i in range(1, 10):
        this_time = now - (delta_hour * i)
        create_set_of_usage(
            prod_jboss, uuid_rhel_jboss, get_times(this_time), ss1, 4)
    
    for i in range(1, 4):
        this_time = now - (delta_hour * i)
        create_set_of_usage(prod_ha, uuid_ha, get_times(this_time), ss1, 7)
    
    for i in range(5, 10):
        this_time = now - (delta_hour * i)
        create_set_of_usage(
            prod_edu, uuid_edu, get_times(this_time), ss1, 5)
    # run import
    results = import_data(force_import=True)
    
    # verify 1 items in db
    lookup = ReportData.objects.all()
Exemplo n.º 2
0
 def drop_product_usage(self):
     ProductUsage.drop_collection()