     (testing "geodetic polygon"
       ;; Invalid points are caught in the schema validation
       (assert-invalid-spatial
-        :geodetic
+        :geodetic 
+        "GEODETIC"
         [(polygon 180 90, -180 90, -180 -90, 180 -90, 180 90)]
         ["Spatial validation error: The shape contained duplicate points. Points 1 [lon=180 lat=90] and 2 [lon=-180 lat=90] were considered equivalent or very close."
          "Spatial validation error: The shape contained duplicate points. Points 3 [lon=-180 lat=-90] and 4 [lon=180 lat=-90] were considered equivalent or very close."

            ["SpatialCoverage" "Geometries"]
            ["[Geometries] cannot be set when the parent collection's GranuleSpatialRepresentation is NO_SPATIAL"])

          "parent collection has no spatial info"
          nil

          "parent collection GranuleSpatialRepresentation is NO_SPATIAL"
          "NO_SPATIAL")))

(deftest missing-spatial-coverage-test
  (let [collection-attrs {:spatial-coverage {:granule-spatial-representation :geodetic}}
        granule-attrs {:format "application/echo10+xml; charset=utf-8"}]
    (assert-invalid collection-attrs
                    granule-attrs


  (testing "through ingest API"
    (let [provider-id (get gran-attributes :provider-id "PROV1")
          coll (d/ingest-umm-spec-collection provider-id (data-umm-c/collection coll-attributes))
          response (d/ingest provider-id (dg/granule-with-umm-spec-collection coll (:concept-id coll) gran-attributes))]
      (is (#{{:status 201} {:status 200}} (select-keys response [:status :errors]))))))

(defn assert-invalid-spatial
  ([coord-sys umm-c-coord-sys shapes errors]
   (assert-invalid-spatial coord-sys umm-c-coord-sys shapes errors :echo10))
  ([coord-sys umm-c-coord-sys shapes errors metadata-format]
   (let [shapes (map (partial umm-s/set-coordinate-system coord-sys) shapes)]
     (assert-invalid {:SpatialExtent (data-umm-c/spatial {:gsr umm-c-coord-sys})}
                     {:spatial-coverage (apply dg/spatial shapes)}
                     ["SpatialCoverage" "Geometries" 0]
                     errors
                     metadata-format))))

(defn assert-valid-spatial
  [coord-sys umm-c-coord-sys shapes]
  (let [shapes (map (partial umm-s/set-coordinate-system coord-sys) shapes)]
    (assert-valid {:SpatialExtent (data-umm-c/spatial {:gsr umm-c-coord-sys})}
                  {:spatial-coverage (apply dg/spatial shapes)})))

(defn assert-conflict
  [gran-attributes errors]
  (let [collection (d/ingest-umm-spec-collection "PROV1" (data-umm-c/collection))
        response (d/ingest "PROV1" (dg/granule-with-umm-spec-collection collection (:concept-id collection) gran-attributes) {:allow-failure? true})]
    (is (= {:status 409
            :errors errors}
           (select-keys response [:status :errors])))))
