Ejemplo n.º 1
0
def create_random_product_scans(latitude_center, longitude_center, radius, count):
    store = stores.Store.create_store("test_store_%f" % random.random())
    stores.StoreInstance.create_store_instance("test_address_%f" % random.random(), latitude_center, longitude_center, store)
    product = product_steps.create_random_product()
    for i in range(1, count):
        latitude = latitude_center + (random.random() * util.meters_to_latitude(radius))
        longitude = longitude_center + (random.random() * util.meters_to_longitude(radius, latitude))
        api_handler.create_product_scan(world.mobile_number, world.password, world.client_uid, product.barcode, products.BARCODE_TYPES.EAN13, str(latitude), str(longitude))
Ejemplo n.º 2
0
def i_cannot_contribute_to_the_crowd_database_on_an_existing_product_with_non_existant_user(step):
    world.mobile_number = "I_DONT_EXIST"
    world.client_uid = "UID_THAT_DOESNT_EXIST"
    product = create_random_product()
    try:
        api_handler.create_product_scan(world.mobile_number, world.password, world.client_uid, product.barcode, products.BARCODE_TYPES.EAN13, "1.0", "2.0")
        raise BaseException("Was able to contribute even though I don't exist!")
    except api_handler.WebserviceException:
        pass
Ejemplo n.º 3
0
def then_i_cannot_contribute_to_the_crowd_database_on_an_existing_product(step):
    product = create_random_product()
    if world.client_uid is None:
        world.client_uid = clients.Client.objects.get_by_password(world.mobile_number, world.password)
    try:
        api_handler.create_product_scan(world.mobile_number, world.password, world.client_uid, product.barcode, products.BARCODE_TYPES.EAN13, "1.0", "2.0")
        raise BaseException("Was able to contribute even though not verified")
    except api_handler.WebserviceException:
        pass
Ejemplo n.º 4
0
def and_i_can_contribute_to_crowd_database_on_an_existing_product(step):
    product = create_random_product()
    api_handler.create_product_scan(world.mobile_number, world.password, world.client_uid, product.barcode, products.BARCODE_TYPES.EAN13, "1.0", "2.0")