Fossil SCM

Added more integration tests.

stephan 2011-09-30 16:36 UTC json
Commit 10e677c968f668feedfd491fc1efd44815955c83
1 file changed +38 -7
--- ajax/i-test/rhino-test.js
+++ ajax/i-test/rhino-test.js
@@ -2,11 +2,12 @@
22
serverUrl:
33
'http://localhost:8080'
44
//'http://fjson/cgi-bin/fossil-json.cgi'
55
//'http://192.168.1.62:8080'
66
,
7
- verbose:true
7
+ verbose:true,
8
+ wiki:{}
89
};
910
(function bootstrap() {
1011
var srcdir = '../js/';
1112
var includes = [srcdir+'json2.js',
1213
srcdir+'whajaj.js',
@@ -19,17 +20,17 @@
1920
TestApp.fossil = new FossilAjaj({
2021
asynchronous:false, /* rhino-based impl doesn't support asynch. */
2122
url:TestApp.serverUrl,
2223
beforeSend:function(req,opt){
2324
if(!TestApp.verbose) return;
24
- print("SENDING REQUEST: opt="+JSON.stringify(opt));
25
- if(req) print("Request="+WhAjaj.stringify(req));
25
+ print("SENDING REQUEST: AJAJ options="+JSON.stringify(opt));
26
+ if(req) print("Request envelope="+WhAjaj.stringify(req));
2627
},
2728
afterSend:function(req,opt){
28
- if(!TestApp.verbose) return;
29
- print("SENT REQUEST: opt="+JSON.stringify(opt));
30
- if(req) print("Request="+WhAjaj.stringify(req));
29
+ //if(!TestApp.verbose) return;
30
+ //print("REQUEST RETURNED: opt="+JSON.stringify(opt));
31
+ //if(req) print("Request="+WhAjaj.stringify(req));
3132
},
3233
onError:function(req,opt){
3334
if(!TestApp.verbose) return;
3435
print("ERROR: "+WhAjaj.stringify(opt));
3536
},
@@ -120,17 +121,47 @@
120121
assert('string' === typeof TestApp.fossil.authToken, 'authToken = '+TestApp.fossil.authToken);
121122
assert( 'string' === typeof TestApp.fossil.userName, 'User name = '+TestApp.fossil.userName);
122123
}
123124
testAnonymousLogin.description = 'Perform anonymous login.';
124125
126
+function testAnonWikiList(){
127
+ TestApp.fossil.sendCommand('/json/wiki/list',undefined,{
128
+ beforeSend:function(req,opt){
129
+ TestApp.fossil.ajaj.options.beforeSend(req,opt);
130
+ assert( req && (req.authToken==TestApp.fossil.authToken) );
131
+ },
132
+ onResponse:function(resp,req){
133
+ assertResponseOK(resp);
134
+ assert( (typeof [] === typeof resp.payload) && resp.payload.length,
135
+ "Wiki list seems to be okay.");
136
+ TestApp.wiki.list = resp.payload;
137
+ }
138
+ });
139
+}
140
+testAnonWikiList.description = 'Fetch wiki list as anonymous uses.';
125141
142
+function testAnonLogout(){
143
+ TestApp.fossil.logout({
144
+ onResponse:function(resp,req){
145
+ assertResponseOK(resp);
146
+ }
147
+ });
148
+ TestApp.fossil.logout({
149
+ onResponse:function(resp,req){
150
+ assertResponseError(resp);
151
+ }
152
+ });
153
+}
154
+testAnonLogout.description = 'Fetch wiki list as anonymous uses.';
126155
127156
(function runAllTests(){
128157
var testList = [
129158
testHAI,
130159
testIAmNobody,
131
- testAnonymousLogin
160
+ testAnonymousLogin,
161
+ testAnonWikiList,
162
+ testAnonLogout
132163
];
133164
var i, f;
134165
for( i = 0; i < testList.length; ++i ){
135166
f = testList[i];
136167
try{
137168
--- ajax/i-test/rhino-test.js
+++ ajax/i-test/rhino-test.js
@@ -2,11 +2,12 @@
2 serverUrl:
3 'http://localhost:8080'
4 //'http://fjson/cgi-bin/fossil-json.cgi'
5 //'http://192.168.1.62:8080'
6 ,
7 verbose:true
 
8 };
9 (function bootstrap() {
10 var srcdir = '../js/';
11 var includes = [srcdir+'json2.js',
12 srcdir+'whajaj.js',
@@ -19,17 +20,17 @@
19 TestApp.fossil = new FossilAjaj({
20 asynchronous:false, /* rhino-based impl doesn't support asynch. */
21 url:TestApp.serverUrl,
22 beforeSend:function(req,opt){
23 if(!TestApp.verbose) return;
24 print("SENDING REQUEST: opt="+JSON.stringify(opt));
25 if(req) print("Request="+WhAjaj.stringify(req));
26 },
27 afterSend:function(req,opt){
28 if(!TestApp.verbose) return;
29 print("SENT REQUEST: opt="+JSON.stringify(opt));
30 if(req) print("Request="+WhAjaj.stringify(req));
31 },
32 onError:function(req,opt){
33 if(!TestApp.verbose) return;
34 print("ERROR: "+WhAjaj.stringify(opt));
35 },
@@ -120,17 +121,47 @@
120 assert('string' === typeof TestApp.fossil.authToken, 'authToken = '+TestApp.fossil.authToken);
121 assert( 'string' === typeof TestApp.fossil.userName, 'User name = '+TestApp.fossil.userName);
122 }
123 testAnonymousLogin.description = 'Perform anonymous login.';
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
 
 
 
 
 
 
 
 
 
 
 
 
 
126
127 (function runAllTests(){
128 var testList = [
129 testHAI,
130 testIAmNobody,
131 testAnonymousLogin
 
 
132 ];
133 var i, f;
134 for( i = 0; i < testList.length; ++i ){
135 f = testList[i];
136 try{
137
--- ajax/i-test/rhino-test.js
+++ ajax/i-test/rhino-test.js
@@ -2,11 +2,12 @@
2 serverUrl:
3 'http://localhost:8080'
4 //'http://fjson/cgi-bin/fossil-json.cgi'
5 //'http://192.168.1.62:8080'
6 ,
7 verbose:true,
8 wiki:{}
9 };
10 (function bootstrap() {
11 var srcdir = '../js/';
12 var includes = [srcdir+'json2.js',
13 srcdir+'whajaj.js',
@@ -19,17 +20,17 @@
20 TestApp.fossil = new FossilAjaj({
21 asynchronous:false, /* rhino-based impl doesn't support asynch. */
22 url:TestApp.serverUrl,
23 beforeSend:function(req,opt){
24 if(!TestApp.verbose) return;
25 print("SENDING REQUEST: AJAJ options="+JSON.stringify(opt));
26 if(req) print("Request envelope="+WhAjaj.stringify(req));
27 },
28 afterSend:function(req,opt){
29 //if(!TestApp.verbose) return;
30 //print("REQUEST RETURNED: opt="+JSON.stringify(opt));
31 //if(req) print("Request="+WhAjaj.stringify(req));
32 },
33 onError:function(req,opt){
34 if(!TestApp.verbose) return;
35 print("ERROR: "+WhAjaj.stringify(opt));
36 },
@@ -120,17 +121,47 @@
121 assert('string' === typeof TestApp.fossil.authToken, 'authToken = '+TestApp.fossil.authToken);
122 assert( 'string' === typeof TestApp.fossil.userName, 'User name = '+TestApp.fossil.userName);
123 }
124 testAnonymousLogin.description = 'Perform anonymous login.';
125
126 function testAnonWikiList(){
127 TestApp.fossil.sendCommand('/json/wiki/list',undefined,{
128 beforeSend:function(req,opt){
129 TestApp.fossil.ajaj.options.beforeSend(req,opt);
130 assert( req && (req.authToken==TestApp.fossil.authToken) );
131 },
132 onResponse:function(resp,req){
133 assertResponseOK(resp);
134 assert( (typeof [] === typeof resp.payload) && resp.payload.length,
135 "Wiki list seems to be okay.");
136 TestApp.wiki.list = resp.payload;
137 }
138 });
139 }
140 testAnonWikiList.description = 'Fetch wiki list as anonymous uses.';
141
142 function testAnonLogout(){
143 TestApp.fossil.logout({
144 onResponse:function(resp,req){
145 assertResponseOK(resp);
146 }
147 });
148 TestApp.fossil.logout({
149 onResponse:function(resp,req){
150 assertResponseError(resp);
151 }
152 });
153 }
154 testAnonLogout.description = 'Fetch wiki list as anonymous uses.';
155
156 (function runAllTests(){
157 var testList = [
158 testHAI,
159 testIAmNobody,
160 testAnonymousLogin,
161 testAnonWikiList,
162 testAnonLogout
163 ];
164 var i, f;
165 for( i = 0; i < testList.length; ++i ){
166 f = testList[i];
167 try{
168

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button