This repository has been archived by the owner on Mar 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.rb
120 lines (97 loc) · 2.99 KB
/
test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#
# citizentools - API fuer Star Citizen
#
# Copyright 2017 [email protected]
#
# This file is part of citizenzools.
# citizenzools is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# citizenzools is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with citizenzools. If not, see <http://www.gnu.org/licenses/>.
require "json"
require "minitest/autorun"
require "open-uri"
class TestVakss < Minitest::Test
def setup
citizen_json = open('http://localhost:4567/api/v2/citizen/perry_hope').read
@citizen = JSON.parse(citizen_json)
org_json = open('http://localhost:4567/api/v2/org/ihope').read
@org = JSON.parse(org_json)
end
# test /citizen
def test_citizen_moniker_is_perry_hope
assert_equal "Perry Hope", @citizen["moniker"]
end
def test_citizen_record_is_635841
assert_equal "635841", @citizen["citizen_record"]
end
def test_citizen_enlisted_is_20141030
assert_equal "20141030", @citizen["enlisted"]
end
def test_citizen_fluency_is_german_english_turkish
assert_equal ["German", "English", "Turkish"], @citizen["fluency"]
end
def test_citizen_orgs_is_ioh_pakt_avocado_gadvocacy_oppf
assert_equal [
{
"org" => "Isle of Hope",
"sid" => "IHOPE",
"type" => "main"
},
{
"org" => "Protection Alliance - Knights of Terra",
"sid" => "PAKT",
"type" => "affiliate"
},
{
"org" => "Evocati - NDA",
"sid" => "AVOCADO",
"type" => "affiliate"
},
{
"org" => "German Advocacy",
"sid" => "GADVOCACY",
"type" => "affiliate"
},
{
"org" => "Operation Pitchfork",
"sid" => "OPPF",
"type" => "affiliate"
}
] , @citizen["orgs"]
end
# test /org
def test_org_name_is_isle_of_hope
assert_equal "Isle of Hope", @org["name"]
end
def test_org_members_is_number
assert_match /\d+/, @org["members"]
end
def test_org_archetype_is_corporation
assert_equal "Corporation", @org["archetype"]
end
def test_org_primary_activity_is_social
assert_equal "Social", @org["primary_activity"]
end
def test_org_secondary_activity_is_security
assert_equal "Security", @org["secondary_activity"]
end
def test_org_commitment_is_regular
assert_equal "Regular", @org["commitment"]
end
def test_org_roleplay_is_no
assert_equal "No", @org["roleplay"]
end
def test_org_membership_is_exclusive
assert_equal "Exclusive", @org["exclusive_membership"]
end
def test_org_logo_is_ihope
assert_match "IHOPE-Logo.png", @org["logo"]
end
end