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
17 import github
::github_curl
22 var auth
: String = get_github_oauth
23 var user_agent
: String = "nit"
24 var testee
: GithubCurl is noinit
26 fun before_test
is before
do
27 testee
= new GithubCurl(auth
, user_agent
)
30 fun test_get_repo
is test
do
31 var uri
= "https://api.github.com/repos/nitlang/nit"
32 var res
= testee
.get_and_check
(uri
)
34 assert res
isa JsonObject
35 assert res
["name"] == "nit"
36 assert res
["owner"] isa JsonObject
39 fun test_get_user
is test
do
40 var uri
= "https://api.github.com/users/Morriar"
41 var res
= testee
.get_and_check
(uri
)
43 assert res
isa JsonObject
44 assert res
["login"] == "Morriar"
45 assert res
["html_url"] == "https://github.com/Morriar"