Beispiel #1
0
def test_offer_delete_scoped_valid(is_resource_admin, app, db, session):
    is_resource_admin.return_value = True
    offer = api.offer_create(test_offer_data, scoped_context)
    api.offer_destroy(offer.offer_id, scoped_context)
    with pytest.raises(e.ResourceNotFound) as excinfo:
        api.offer_get("NotHere", scoped_context)
    assert (excinfo.value.code == 404)
Beispiel #2
0
def test_offer_delete_scoped_invalid(app, db, session):
    offer = api.offer_create(test_offer_data, scoped_context)
    api.offer_destroy(offer.marketplace_offer_id, scoped_context_2)
    check = api.offer_get(offer.marketplace_offer_id, scoped_context)
    assert check is not None
Beispiel #3
0
def test_offer_delete_admin(app, db, session):
    offer = api.offer_create(test_offer_data, scoped_context_2)
    api.offer_destroy(offer.marketplace_offer_id, admin_context)
    check = api.offer_get(offer.marketplace_offer_id, scoped_context_2)
    assert check is None
Beispiel #4
0
def test_offer_delete_scoped_invalid(app, db, session):
    offer = api.offer_create(test_offer_data, scoped_context)
    with pytest.raises(e.ResourceNoPermission) as excinfo:
        api.offer_destroy(offer.marketplace_offer_id, scoped_context_2)
    assert (excinfo.value.code == 403)
Beispiel #5
0
def test_offer_delete_scoped_valid(app, db, session):
    offer = api.offer_create(test_offer_data, scoped_context)
    api.offer_destroy(offer.marketplace_offer_id, scoped_context)
    with pytest.raises(e.ResourceNotFound) as excinfo:
        api.offer_get("NotHere", scoped_context)
    assert (excinfo.value.code == 404)
Beispiel #6
0
 def destroy(self, context):
     db.offer_destroy(self.marketplace_offer_id, context)
     return True
Beispiel #7
0
 def destroy(self, context):
     db.offer_destroy(self.offer_id, context)
     return True
Beispiel #8
0
def test_offer_delete(app, db, session):
    offer = api.offer_create(test_offer_data)
    api.offer_destroy(offer.marketplace_offer_id)
    check = api.offer_get(offer.marketplace_offer_id)
    assert check is None
Beispiel #9
0
 def destroy(self):
     db.offer_destroy(self.marketplace_offer_id)
     return True