@@ -964,6 +964,33 @@ def resp_import_github(url, request):
964964 self .assertEqual (ret ["full_path" ], "/" .join ((base_path , name )))
965965 self .assertTrue (ret ["full_name" ].endswith (name ))
966966
967+ def test_applications (self ):
968+ content = '{"name": "test_app", "redirect_uri": "http://localhost:8080", "scopes": ["api", "email"]}'
969+ json_content = json .loads (content )
970+
971+ @urlmatch (
972+ scheme = "http" ,
973+ netloc = "localhost" ,
974+ path = "/api/v4/applications" ,
975+ method = "post" ,
976+ )
977+ def resp_application_create (url , request ):
978+ headers = {"content-type" : "application/json" }
979+ return response (200 , json_content , headers , None , 5 , request )
980+
981+ with HTTMock (resp_application_create ):
982+ application = self .gl .applications .create (
983+ {
984+ "name" : "test_app" ,
985+ "redirect_uri" : "http://localhost:8080" ,
986+ "scopes" : ["api" , "email" ],
987+ "confidential" : False ,
988+ }
989+ )
990+ self .assertEqual (application .name , "test_app" )
991+ self .assertEqual (application .redirect_uri , "http://localhost:8080" )
992+ self .assertEqual (application .scopes , ["api" , "email" ])
993+
967994 def _default_config (self ):
968995 fd , temp_path = tempfile .mkstemp ()
969996 os .write (fd , valid_config )
0 commit comments