@@ -31,10 +31,12 @@ ngDescribe({
3131 } ;
3232 deps . osmAPI . setAuthAdapter ( adapter ) ;
3333 } ;
34+
3435 it ( 'should have URL configured' , function ( ) {
3536 var url = 'http://api.openstreetmap.org/api' ;
3637 expect ( deps . osmAPI . url ) . toBe ( url ) ;
3738 } ) ;
39+
3840 it ( 'should access to oauth dependency if set' , function ( ) {
3941 var oauthDep = { } ;
4042 expect ( deps . osmAPI . _oauth ) . toBe ( null ) ;
@@ -112,6 +114,7 @@ ngDescribe({
112114 deps . $rootScope . $digest ( ) ;
113115 deps . $httpBackend . flush ( ) ;
114116 } ) ;
117+
115118 it ( 'should put works (case of create node) to return id' , function ( ) {
116119 setHTTPAdapter ( deps ) ;
117120 var method = '/0.6/node/create' ;
@@ -139,6 +142,7 @@ ngDescribe({
139142 deps . $rootScope . $digest ( ) ;
140143 deps . $httpBackend . flush ( ) ;
141144 } ) ;
145+
142146 it ( 'should delete works' , function ( ) {
143147 setHTTPAdapter ( deps ) ;
144148 var method = '/0.6/node/132134' ;
@@ -153,6 +157,7 @@ ngDescribe({
153157 deps . $rootScope . $digest ( ) ;
154158 deps . $httpBackend . flush ( ) ;
155159 } ) ;
160+
156161 it ( 'should createChangeset works' , function ( ) {
157162 setHTTPAdapter ( deps ) ;
158163 var method = '/0.6/changeset/create' ;
@@ -173,6 +178,27 @@ ngDescribe({
173178 deps . $httpBackend . flush ( ) ;
174179 } ) ;
175180
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+
176202 it ( 'should getLastOpenedChangesetId works' , function ( ) {
177203 setHTTPAdapter ( deps ) ;
178204 var method = '/0.6/changesets?open=true&user=1' ;
@@ -190,6 +216,7 @@ ngDescribe({
190216 deps . $rootScope . $digest ( ) ;
191217 deps . $httpBackend . flush ( ) ;
192218 } ) ;
219+
193220 it ( 'should closeChangeset works' , function ( ) {
194221 setHTTPAdapter ( deps ) ;
195222 var id = '1234' ;
@@ -206,4 +233,4 @@ ngDescribe({
206233
207234 }
208235
209- } ) ;
236+ } ) ;
0 commit comments