weekly misc items: test exceptions, querying shopify returns, git hunking

with pytest.raises(<ExceptionName>):    assert your_function(some_arg)

2. for querying refunds in shopify, you can now query the Orders object using graphql using updated_at field! even though documentation does not list this field as a queryable field, they have an example query at bottom of page which led me to this.

orders(query:"updated_at:>=2020-06-03 created_at:<2020-06-03")

before realizing this, i would have queried tender transactions via REST api and then use the order id to query the full order details via GraphQL. this is because:

  • TenderTransaction is available at query root but does not provide order id to map back to an order id

sample REST endpoint would be:

tender_transactions.json?updated_at_min=2020-06-01 10:22:51 -0400'

be cautious of using timestamps to query orders in shopify. for example for given order with createdAt date of:

2020-06-04T04:27:55Z

i tried the following and the bulk query still return the record:

today = '2020-06-03'today = '2020-06-04T04:30:55Z' # still shows 2020-06-04T04:27:55Z record

for query filter:

created_orders(query:"created_at:>={today}")

3. not a new finding, but i like using git hunking to select certain pieces of code for commit to keep my commit history clean when i have multiple unrelated changes made but they should not be included with same commit comment.

git add -p <your-file.py>

--

--

--

quick notes, snippets, bugs, and fixes

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Rails Code Challenge

The eli4d Gazette — Issue 021 | eli4d.com on WordPress.com

Scala vs Java?

Understanding ZMAP+ File Format

⚠️ Call Center Prioritisation is changing ⚠️

Anura DAO

Building your First Serverless App in Node.js with AWS Lambda + S3 + API Gateway

Integrate RaspberryPi with Google Cloud IoT

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
diary of a codelovingyogi

diary of a codelovingyogi

quick notes, snippets, bugs, and fixes

More from Medium

9 Must-have React Developer Tools to Create Better Apps Faster

5 Reasons to Adopt Progressive Web Apps

5 Reasons to Adopt Progressive Web Apps

How I got into AWS as a Community Builder

The 5 online coding and development tools you need to know