Hi Folks,

I've functions that do a subset of tasks on a sqlalchemy object for a 
bigger function. For ex,

def delete_certificate_store(CS):

    CS.is_archived = True
    # Also delete the associated CARequest object
    for DR in CS.CA_request:
        db.session.delete(DR)
    # Delete the Certificate Object only if this it's the only order for 
that Certificate
    if len(CS.order.certificate.get_all_unarchived_orders()) == 1 and CS in 
CS.order.certificate.get_all_unarchived_certificate_stores():
        CS.order.certificate.is_archived = True

Now, this function modifies a database. How do we test functions like 
these? If I use mocks for DB related stuff, I'm not really testing it. 

As a human, I test these functions by executing them and verifying if the 
intended changes happened in the DB. How's that done by testing frameworks 
like pytest? Sorry, if this is a stupid question, I'm new to testing.

Thanks


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to