ci: do not error when nothing with nitunit_some
[nit.git] / lib / github / test_github_curl.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
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
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
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.
14
15 module test_github_curl is test
16
17 import github::github_curl
18
19 class TestGithubCurl
20 test
21
22 var auth: String = get_github_oauth
23 var user_agent: String = "nit"
24 var testee: GithubCurl is noinit
25
26 fun before_test is before do
27 testee = new GithubCurl(auth, user_agent)
28 end
29
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)
33
34 assert res isa JsonObject
35 assert res["name"] == "nit"
36 assert res["owner"] isa JsonObject
37 end
38
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)
42
43 assert res isa JsonObject
44 assert res["login"] == "Morriar"
45 assert res["html_url"] == "https://github.com/Morriar"
46 end
47 end