1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 module test_github_curl
is test_suite
17 import github
::github_curl
23 var auth
: String = get_github_oauth
24 var user_agent
: String = "nit"
25 var testee
: GithubCurl is noinit
27 redef fun before_test
do
28 testee
= new GithubCurl(auth
, user_agent
)
32 var uri
= "https://api.github.com/repos/privat/nit"
33 var res
= testee
.get_and_check
(uri
)
35 assert res
isa JsonObject
36 assert res
["name"] == "nit"
37 assert res
["owner"] isa JsonObject
41 var uri
= "https://api.github.com/users/Morriar"
42 var res
= testee
.get_and_check
(uri
)
44 assert res
isa JsonObject
45 assert res
["login"] == "Morriar"
46 assert res
["html_url"] == "https://github.com/Morriar"