]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
DRYD-22: Add more XmlReplay tests.
authorRay Lee <rhlee@berkeley.edu>
Fri, 22 Jul 2016 03:39:48 +0000 (20:39 -0700)
committerRay Lee <rhlee@berkeley.edu>
Fri, 22 Jul 2016 23:48:10 +0000 (16:48 -0700)
services/IntegrationTests/src/test/resources/test-data/xmlreplay/security-oauth.xml
services/IntegrationTests/src/test/resources/test-data/xmlreplay/security-oauth/password-grant-reader.txt [new file with mode: 0644]

index f54773b72caa131103dab5a5cb384748e4a40e77..38eedc2be691fe1ad3163719bde00bfb6902aa9d 100644 (file)
             <expectedCodes>200,201</expectedCodes>
         </test>
     </testGroup>
+    
+    <testGroup ID="readerTokenUsage">
+        <!-- Token grant with password should succeed-->
+        <test ID="readerTokenGrant" auth="cspace-ui">
+            <method>POST</method>
+            <contentType>application/x-www-form-urlencoded</contentType>
+            <uri>/cspace-services/oauth/token</uri>
+            <filename>security-oauth/password-grant-reader.txt</filename>
+            <expectedCodes>200</expectedCodes>
+        </test>
+        <!-- Getting a resource with the granted access token should succeed -->
+        <test ID="readerGetWithToken" tokenauth='${readerTokenGrant.got("//access_token")}'>
+            <method>GET</method>
+            <uri>/cspace-services/collectionobjects</uri>
+            <expectedCodes>200</expectedCodes>
+        </test>
+        <!-- Posting a resource with the granted access token should fail -->
+        <test ID="readerPostWithToken" tokenauth='${readerTokenGrant.got("//access_token")}'>
+            <method>POST</method>
+            <uri>/cspace-services/collectionobjects</uri>
+            <filename>collectionobject/co1.xml</filename>
+            <expectedCodes>403</expectedCodes>
+        </test>
+    </testGroup>
 </xmlReplay>
diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security-oauth/password-grant-reader.txt b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/security-oauth/password-grant-reader.txt
new file mode 100644 (file)
index 0000000..b74be9d
--- /dev/null
@@ -0,0 +1 @@
+grant_type=password&username=reader@core.collectionspace.org&password=reader
\ No newline at end of file