             [objective8.users :as users]
             [objective8.objectives :as objectives]
             [objective8.middleware :as m])) 
-
-
-;; Testing from http request -> making correct calls within writers namespace
-;; Mock or stub out 'writers' namespace
 
 (def app (helpers/test-context))
 (def OBJECTIVE_ID 1)


        (fact "the invitation is stored"
              (let [{obj-id :_id created-by-id :created-by-id} (sh/store-an-objective)
                    the-invitation (an-invitation obj-id created-by-id)
                    {response :response} (p/request app (str "/api/v1/objectives/" obj-id "/writer-invitations")
                                                    :request-method :post
                                                    :content-type "application/json"
                                                    :body (json/generate-string the-invitation))]
                (:status response) => 201
                (:body response) => (helpers/json-contains (assoc the-invitation
                                                                  :_id integer?))
                (:headers response) => (helpers/location-contains (str "/api/v1/objectives/" obj-id "/writer-invitations/"))))

        (fact "a 423 (resource locked) status is returned when drafting has started on the objective"

    :objective-id objective-id
    :invited-by-id invited-by-id }))

(facts "POST /api/v1/objectives/:id/writer-invitations" :integration
       (against-background
        (m/valid-credentials? anything anything anything) => true)
