Skip to content

Commit

Permalink
test les réponses http des endpoints DTS avec github CI
Browse files Browse the repository at this point in the history
  • Loading branch information
philippepons committed Mar 7, 2024
1 parent 2d25775 commit 1b99a9f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/dots-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@ jobs:
cd basex
chmod +x bin/basex
- name: Run DoTS XQuery Tests
run: |
./basex/bin/basex ./tests/launcher.xq
- name: Start BaseX Server
- name: Start BaseX Server and Run Init Tests on Endpoints
run: |
./basex/bin/basexhttp
./basex/bin/basex ./tests/launcher.xq
./basex/bin/basexhttpstop
21 changes: 21 additions & 0 deletions tests/initTestsEndpoint.xqm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
xquery version '3.0' ;

module namespace initTests = "https://github.com/chartes/dots/initTests";

declare function initTests:endpoint($url) {
let $statutCode := http:send-request(<http:request method='get' status-only='true'/>, $url)
return
normalize-space($statutCode/@status)
};

declare %unit:test function initTests:check-value-response200($url) {
let $expected := "200"
return
unit:assert-equals(initTests:endpoint($url), $expected)
};

declare %unit:test function initTests:check-value-response400($url) {
let $expected := "400"
return
unit:assert-equals(initTests:endpoint($url), $expected)
};
6 changes: 5 additions & 1 deletion tests/launcher.xq
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
xquery version '3.0' ;

import module namespace test = "https://github.com/chartes/dots/tests" at "utilsTest.xqm";
import module namespace initTests = "https://github.com/chartes/dots/initTests" at "initTestsEndpoint.xqm";


(: :)
test:check-metadata-output()
initTests:check-value-response200("http://localhost:8080/api/dts"),
initTests:check-value-response200("http://localhost:8080/api/dts/collection"),
initTests:check-value-response400("http://localhost:8080/api/dts/navigation"),
initTests:check-value-response400("http://localhost:8080/api/dts/document")

0 comments on commit 1b99a9f

Please sign in to comment.