def test_offer_update_scoped_invalid(app, db, session): offer = api.offer_create(test_offer_data, scoped_context) with pytest.raises(e.ResourceNoPermission) as excinfo: api.offer_update(offer.marketplace_offer_id, dict(status='testing'), scoped_context_2) assert (excinfo.value.code == 403) check = api.offer_get(offer.marketplace_offer_id, scoped_context) assert check.status != 'testing'
def test_offer_update_scoped_invalid(is_resource_admin, app, db, session): is_resource_admin.return_value = True offer = api.offer_create(test_offer_data, scoped_context) with pytest.raises(e.ResourceNoPermission) as excinfo: api.offer_update(offer.offer_id, dict(status=statuses.EXPIRED), scoped_context_2) assert (excinfo.value.code == 403) check = api.offer_get(offer.offer_id, scoped_context) assert check.status != statuses.EXPIRED
def test_offer_update_scoped_valid(app, db, session): offer = api.offer_create(test_offer_data, scoped_context) offer = api.offer_update(offer.marketplace_offer_id, dict(status='testing'), scoped_context) check = api.offer_get(offer.marketplace_offer_id, scoped_context) assert check.status == 'testing'
def test_offer_update(app, db, session): offer = api.offer_create(test_offer_data) offer = api.offer_update(offer.marketplace_offer_id, dict(status='testing')) check = api.offer_get(offer.marketplace_offer_id) assert check.status == 'testing' assert check.creator_id == '3456'
def test_offer_update_scoped_valid(is_resource_admin, app, db, session): is_resource_admin.return_value = True offer = api.offer_create(test_offer_data, scoped_context) offer = api.offer_update(offer.offer_id, dict(status=statuses.EXPIRED), scoped_context) check = api.offer_get(offer.offer_id, scoped_context) assert check.status == statuses.EXPIRED
def save(self, context): updates = self.obj_get_changes() db_offer = db.offer_update(self.marketplace_offer_id, updates, context) return self._from_db_object(self, db_offer)