misc/vim: inform the user when no results are found
[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_suite
16
17 import github::github_curl
18 import test_suite
19
20 class TestGithubCurl
21 super TestSuite
22
23 var auth: String = get_github_oauth
24 var user_agent: String = "nit"
25 var testee: GithubCurl is noinit
26
27 redef fun before_test do
28 testee = new GithubCurl(auth, user_agent)
29 end
30
31 fun test_get_repo do
32 var uri = "https://api.github.com/repos/privat/nit"
33 var res = testee.get_and_check(uri)
34
35 assert res isa JsonObject
36 assert res["name"] == "nit"
37 assert res["owner"] isa JsonObject
38 end
39
40 fun test_get_user do
41 var uri = "https://api.github.com/users/Morriar"
42 var res = testee.get_and_check(uri)
43
44 assert res isa JsonObject
45 assert res["login"] == "Morriar"
46 assert res["html_url"] == "https://github.com/Morriar"
47 end
48 end