Skip to content

Commit

Permalink
Merge pull request #49 from ba-st/48-Fail-to-load-Stargate-v2---Test-…
Browse files Browse the repository at this point in the history
…Group-

Changed test case to not depend on unit test of Hyperspace.
  • Loading branch information
gcotelli authored Aug 8, 2019
2 parents 40ff178 + d4f1ed7 commit 8506bb7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 16 deletions.
16 changes: 0 additions & 16 deletions source/Stargate-Model-Tests/HTTPNotAcceptableTest.extension.st

This file was deleted.

33 changes: 33 additions & 0 deletions source/Stargate-Model-Tests/HyperspaceExtensionsTest.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Class {
#name : #HyperspaceExtensionsTest,
#superclass : #TestCase,
#category : #'Stargate-Model-Tests-Extensions'
}

{ #category : #tests }
HyperspaceExtensionsTest >> testBadRequestAsJSON [

| error json |

error := HTTPClientError badRequest messageText: 'Ouch!'.
json := NeoJSONObject fromString: ( NeoJSONWriter toStringPretty: error ).

self
assert: json message equals: 'Ouch!';
assert: json code equals: 400
]

{ #category : #tests }
HyperspaceExtensionsTest >> testNotAcceptableAsJSON [

| error json |

error := HTTPNotAcceptable messageText: 'Ouch!' accepting: {'application/xml' asMediaType}.
json := NeoJSONObject fromString: ( NeoJSONWriter toStringPretty: error ).

self
assert: json message equals: 'Ouch!';
assert: json code equals: 406;
assert: json allowedMediaTypes size equals: 1;
assert: json allowedMediaTypes first equals: 'application/xml'
]

0 comments on commit 8506bb7

Please sign in to comment.