Fork me on GitHub
#clojure-europe
<
2021-08-11
>
dharrigan05:08:27

Good Morning!

RAMart05:08:22

☀️ 😎

otfrom05:08:59

Thx for finding a 🧠 for me @vemv I hope this one works

4
vemv06:08:56

🧠️ if everything else fails

simongray06:08:06

I’ll be getting my second jab today. I am dreading the side-effects since everyone seems to get severe side-effects the second time.

jmayaalv10:08:15

second one on pfizer had 0 side effects for me and my wife, you will be fine!

simongray06:08:23

well, maybe not “severe”, but perhaps enough to take a sick day

mpenet06:08:40

Didn't get anything, just sore arm for a day

simongray06:08:04

Ok, I’m hoping that’s what’s in store (that’s what happened for the first jab), but seems like most people are down with a fever for 1-2 days when they get the second pfizer/moderna shot.

4
genRaiy06:08:42

Same as @mpenet for me

djm06:08:43

My arm was barely even sore after the second one (it was was after the first)

seancorfield06:08:13

I had a pretty rough reaction to Moderna #2 but an elderly friend of ours who had initially resisted getting the vaccine altogether because of "horrible allergies" had zero reaction whatsoever. YMMV.

agigao06:08:19

Morning Clojurians! Woke up with a question in mind - which library would you suggest for testing api endpoints? 😶🌫️

dharrigan07:08:37

wiremock is a good choice, used it in the past, quite good for doing testin.

seancorfield07:08:05

@chokheli Do you mean writing tests to verify an HTTP-based service "works"? We just use clojure.test or expectations.clojure.test and write expected behaviors (results) for a variety of HTTP calls. One of the areas where we're pretty religious about TDD, rather than just "writing tests for code".

dharrigan07:08:17

use-fixtures :once (fn [f] (wmk/wiremock-fixture {:port wiremock-port} f)))

(defexpect filter-agreements
  (let [request (str "/associations/v1/query")]
    (expecting
     "valid association should keep policy in policies"
     (wmk/with-stubs
       [{:req [:POST request] :res [200 {:body (utils/map->string policy)}]}]
       (expect policy (filter-for-valid-agreement policies to app-config))))
  ...
  ...

dharrigan07:08:40

(is a little example, of using wiremock to return a response based upon a request).

seancorfield07:08:54

If you're mocking the service, you're not actually testing the API endpoint tho'...?

dharrigan07:08:08

I'm mocking out an external API

dharrigan07:08:13

one that this service invokes

dharrigan07:08:43

but I see what you mean too

dharrigan07:08:22

if you're testing your own internal APIs, then I do what you do, I just write expecations.

seancorfield07:08:43

I guess we'll have to wait and see what Giga means 🙂

dharrigan07:08:00

probably your reasoning 🙂

slipset07:08:01

Morning! @simongray I got nothing but a sore shoulder from my second shot.

slipset07:08:09

For testing our api-endpoints, we’ve made some stuff inspired by Page Objects, and in that way got a lot of http-specific noise away from our tests:

(api/deftest basic-sanity-tests
  ;; These are basic sanity tests and not a replacement for real
  ;; integration tests
  (api/as :org-admin
    (api/create-group {:name "My group"})
    (let [groups (api/groups)
          g (first (filter (comp #{"My group"} :name) groups))
          user-id (core/id (api/current-user))]
      (testing "Writer can't create groups, or delete existing ones"
        (api/as :writer
          (api/has-status? 403 (api/create-group {:name "Bad"}))
          (api/has-status? 403 (api/delete-group (core/id g)))))
      (testing "Basic group operations"
        (api/update-group (assoc g :name "Foobar"))
        (is (= "Foobar" (:name (api/group (core/id g)))))
        (api/update-group-users (core/id g) :add {:userIds [user-id]})
        (api/delete-group (core/id g))
        (api/has-status? 404 (api/group (core/id g)))
        (is (= (dec (count groups))
               (count (api/groups))))))))
so api/create-group executes an http-request under the hood, and asserts (since it’s a create that we get a 201 (I believe) status code, otherwise it fails the test.

slipset07:08:11

IMO this makes for tests that are fairly easy to write, and most importantly, quite easy to read, at least compared to what we had before.

anthony-galea08:08:55

morning! @simongray just a slightly sore arm here as well

reefersleep08:08:56

Good morning 😎

mccraigmccraig08:08:47

måning! @simongray i got a day's mild fever starting about 12hrs after the second moderna shot

solf09:08:23

After both jabs my arm was sore for 36 hours. I don’t know if “sore” is the right word, I usually use it to describe normal after-workout muscle pain, but in this case it was pretty painful (could not use the arm to lift anything heavier than a mug)

slipset09:08:59

Mine was more like a hard punch in the shoulder more than workout sore.

solf09:08:29

Yeah, something like that. A hard punch that hurts for a day and a half

jasonbell15:08:08

Oh boy I upset everyone on Medium 🙂

genRaiy15:08:42

Are you sure? It's a big place

jasonbell15:08:46

@raymcdermott Yeah, some of the comments are golden 🙂

jasonbell15:08:30

It got picked up by the Medium email curators and sent to all the Data Science types I think

jasonbell15:08:46

Some of them got quite pitch forky about it all

😂 6
seancorfield16:08:44

Like Medium isn't already full of click-bait-y titles... :face_with_rolling_eyes:

😝 2
seancorfield16:08:08

That is priceless @U0K1RLM99! 🙂

seancorfield16:08:43

(heavily "clapped" so it reaches -- and annoys -- even more people!)

jasonbell16:08:37

@U0ETXRFEW That was my favourite comment, he got a very long reply 🙂

jasonbell16:08:29

@U04V70XH6 It had to be done, odd that I got so much love and hate, when the same kind of titles with pointless snake oil don’t get as much pushback. So I wrote this 🙂

pithyless18:08:51

It is unclear to me, whether these steps must be followed in that precise order and if I should repeat ad nauseam until success. I suggest selling a "1M/YR Data Science and ML Mastery" video course that will go into the nitty gritty details that can't be explained in a 3-point Medium article and be well on your way to millions yourself. Looking forward to the upselling email newsletter!

8
jasonbell13:08:35

Just to follow up: Over 1000+ claps. 25% of the comments just did not get the joke. 26k+ views.

metal 3
otfrom17:08:09

If this weather keeps up I'm going to need to evolve gills

🐠 6