@@ -31,10 +31,12 @@ ngDescribe({
31
31
} ;
32
32
deps . osmAPI . setAuthAdapter ( adapter ) ;
33
33
} ;
34
+
34
35
it ( 'should have URL configured' , function ( ) {
35
36
var url = 'http://api.openstreetmap.org/api' ;
36
37
expect ( deps . osmAPI . url ) . toBe ( url ) ;
37
38
} ) ;
39
+
38
40
it ( 'should access to oauth dependency if set' , function ( ) {
39
41
var oauthDep = { } ;
40
42
expect ( deps . osmAPI . _oauth ) . toBe ( null ) ;
@@ -112,6 +114,7 @@ ngDescribe({
112
114
deps . $rootScope . $digest ( ) ;
113
115
deps . $httpBackend . flush ( ) ;
114
116
} ) ;
117
+
115
118
it ( 'should put works (case of create node) to return id' , function ( ) {
116
119
setHTTPAdapter ( deps ) ;
117
120
var method = '/0.6/node/create' ;
@@ -139,6 +142,7 @@ ngDescribe({
139
142
deps . $rootScope . $digest ( ) ;
140
143
deps . $httpBackend . flush ( ) ;
141
144
} ) ;
145
+
142
146
it ( 'should delete works' , function ( ) {
143
147
setHTTPAdapter ( deps ) ;
144
148
var method = '/0.6/node/132134' ;
@@ -153,6 +157,7 @@ ngDescribe({
153
157
deps . $rootScope . $digest ( ) ;
154
158
deps . $httpBackend . flush ( ) ;
155
159
} ) ;
160
+
156
161
it ( 'should createChangeset works' , function ( ) {
157
162
setHTTPAdapter ( deps ) ;
158
163
var method = '/0.6/changeset/create' ;
@@ -173,6 +178,27 @@ ngDescribe({
173
178
deps . $httpBackend . flush ( ) ;
174
179
} ) ;
175
180
181
+ it ( 'should createChangeset via specific author name works' , function ( ) {
182
+ setHTTPAdapter ( deps ) ;
183
+ var method = '/0.6/changeset/create' ;
184
+ var comment = 'my changeset' ;
185
+ var author = "foobar" ;
186
+ var url = deps . osmAPI . url + method ;
187
+ var response = '3147' ; //The ID of the newly created changeset
188
+ var xml = '<osm>' ;
189
+ xml += '<changeset><tag k="created_by" v="foobar" />' ;
190
+ xml += '<tag k="comment" v="my changeset" />' ;
191
+ xml += '</changeset></osm>' ;
192
+ deps . $httpBackend . expectPUT ( url , xml ) . respond ( 200 , response ) ;
193
+ deps . osmAPI . createChangeset ( comment , author )
194
+ . then ( function ( data ) {
195
+ expect ( typeof data ) . toBe ( 'string' ) ;
196
+ expect ( data ) . toBe ( response ) ;
197
+ } ) ;
198
+ deps . $rootScope . $digest ( ) ;
199
+ deps . $httpBackend . flush ( ) ;
200
+ } ) ;
201
+
176
202
it ( 'should getLastOpenedChangesetId works' , function ( ) {
177
203
setHTTPAdapter ( deps ) ;
178
204
var method = '/0.6/changesets?open=true&user=1' ;
@@ -190,6 +216,7 @@ ngDescribe({
190
216
deps . $rootScope . $digest ( ) ;
191
217
deps . $httpBackend . flush ( ) ;
192
218
} ) ;
219
+
193
220
it ( 'should closeChangeset works' , function ( ) {
194
221
setHTTPAdapter ( deps ) ;
195
222
var id = '1234' ;
@@ -206,4 +233,4 @@ ngDescribe({
206
233
207
234
}
208
235
209
- } ) ;
236
+ } ) ;
0 commit comments