@@ -9,18 +9,67 @@ class UnitySiteTest extends TestCase
9
9
{
10
10
public static function SSHKeyProvider ()
11
11
{
12
- return [
13
- [false , "" ],
14
- [false , "foobar " ],
15
- [false , "1 " ],
16
- [false , '{"key": "value"} ' ],
17
- [true , "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+XqO25MUB9x/pS04I3JQ7rMGboWyGXh0GUzkOrTi7a " ],
18
- [false , " ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+XqO25MUB9x/pS04I3JQ7rMGboWyGXh0GUzkOrTi7a " ],
19
- //phpcs:disable
20
- [true , "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJNqo8NKTfXgCsaE3ly0tDCfwFuFgJiftup0bIZnRi5bP5QgDN5BFeJfEUPSY/s/GL2hUAjkz3ytGqvadt84W7w= " ],
21
- [true , "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAIAQDMHfRgu2HjTAODg+1yAXeZalNrT3S0sXv7fqC9/uJW86AHU6l384TpSEoqVbl4cke8lev49ljsEg50ZppoC4fiP6+nAeBy609VWfcHBmbVDeVdLZiAh2XpNW3Fns6ecM24OPr7kdxuhV8pKTMupXYc/mEUdKTB7DiQcRWcLp8BhX14K3PuFbiprqnacoeiu1In9SLKZd2E4vg2TrhptdZuuav4WX0r2s2uUwAz+7jpXWYoXUUjfmImEg6h9ETCzKGFwHYATn879WW+28RUOIurfUUU5njnGmtVoWG1s0L7JpoJfu16ePdcPCEpn92coP8DpFw10iQwh4AsjIdEVYEYfjtxbdk5TqACkfgKo+h9G3nNXO6x8mGjhfNa6CHF+wVJ4RrJWdhBGfKog+CtD+NHDYXFbyciGT2CtGTFay182DdUg2MoXn4eSmPEqZJ+kHtJ0mwe0nKtLNwik4c/54X1rZLETauEFMKRE3/JSlAdAMm0jZNW7fadQOJHB63q/yxyCFLztLrtzhZlBH0DoGuGdHxznbKYDctcQypztP2aG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DI1WVG9Nfo5w1UhGSqcn4oQ== " ,
20
+ implode ("" , [
21
+ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAIAQDMHfRgu2HjTAODg+1yAXeZ " ,
22
+ "alNrT3S0sXv7fqC9/uJW86AHU6l384TpSEoqVbl4cke8lev49ljsEg50Zppo " ,
23
+ "C4fiP6+nAeBy609VWfcHBmbVDeVdLZiAh2XpNW3Fns6ecM24OPr7kdxuhV8p " ,
24
+ "KTMupXYc/mEUdKTB7DiQcRWcLp8BhX14K3PuFbiprqnacoeiu1In9SLKZd2E " ,
25
+ "4vg2TrhptdZuuav4WX0r2s2uUwAz+7jpXWYoXUUjfmImEg6h9ETCzKGFwHYA " ,
26
+ "Tn879WW+28RUOIurfUUU5njnGmtVoWG1s0L7JpoJfu16ePdcPCEpn92coP8D " ,
27
+ "pFw10iQwh4AsjIdEVYEYfjtxbdk5TqACkfgKo+h9G3nNXO6x8mGjhfNa6CHF " ,
28
+ "+wVJ4RrJWdhBGfKog+CtD+NHDYXFbyciGT2CtGTFay182DdUg2MoXn4eSmPE " ,
29
+ "qZJ+kHtJ0mwe0nKtLNwik4c/54X1rZLETauEFMKRE3/JSlAdAMm0jZNW7fad " ,
30
+ "QOJHB63q/yxyCFLztLrtzhZlBH0DoGuGdHxznbKYDctcQypztP2aG4G+W1go " ,
31
+ "zwNmwsJRLY3pWos377QRUOq0w3qvcw9BZwigfqixGWHbC2JUyxqoa4opez6z " ,
32
+ "oDH+tjvJQ0iKv9DQrVOdh8e6NzHMlSnri3r34K5NzDIvV3uROO1yC7pbHogO " ,
33
+ "S2XmO+nnJYlnINhitXe9+gcfkcEwZs14lxrxcAElJmJOSPE+uui80ZMUHd6C " ,
34
+ "lemoptFE4cAhdczmkQXURbpzWguHRSWk+5/AXb5r1P7AYpaZSRFfOqy4oB/v " ,
35
+ "6rKTBjplH7LYi3otykeB1PooHnUfpziOLLFq5ghVdCU8R10yE43drDRnu8dF " ,
36
+ "pirxBF6AAUzQpUMb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3ySfQ== " ,
68
+ ])
23
69
];
70
+ $ validKeysArgs = array_map (function ($ x ){return [true , $ x ];}, $ validKeys );
71
+ $ invalidKeysArgs = array_map (function ($ x ){return [false , $ x ];}, $ HTTP_HEADER_TEST_INPUTS );
72
+ return $ validKeysArgs + $ invalidKeysArgs ;
24
73
}
25
74
26
75
#[DataProvider("SSHKeyProvider " )]
@@ -30,26 +79,4 @@ public function testTestValidSSHKey(bool $expected, string $key)
30
79
$ this ->assertEquals ($ expected , $ SITE ->testValidSSHKey ($ key ));
31
80
}
32
81
33
- public static function providerTestGetGithubKeys ()
34
- {
35
- return [
36
- # empty
37
- ["" , []],
38
- # nonexistent user
39
- ["asdfkljhasdflkjashdflkjashdflkasjd " , []],
40
- # user with no keys
41
- ["sheldor1510 " , []],
42
- # user with 1 key
43
- //phpcs:disable
44
- ["simonLeary42 " , ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDGRl6JWPj+Gq2Lz9GjYdUl4/unLoFOyfgeiII1CxutpabPByRJbeuonR0zTpn51tZeYuAUOJBOeKt+Lj4i4UDGl6igpdXXSwkBXl7jxfRPwJ6WuTkDx7Z8ynwnqlDV2q089q4OX/b/uuHgsIhIBwrouKsRQaZIqTbwNMfiqQ2zl14V0KMrTPzOiwR6Q+hqSaR5Z29WKE7ff/OWzSC3/0T6avCmcCbQaRPJdVM+QC17B0vl8FzPwRjorMngwZ0cImdQ/0Ww1d12YAL7UWp1c2egfnthKP3MuQZnNF8ixsAk1eIIwTRdiI87BOoorW8NXhxXmhyheRCsFwyP4LJBqyUVoZJ0UYyk0AO4G9EStnfpiz8YXGK+M1G4tUrWgzs1cdjlHtgCWUmITtgabnYCC4141m7n4GZTk2H/lSrJcvAs3JEiwLTj1lzeGgzeSsz/XKsnOJyzjEVr2Jp3iT+J9PbQpfS0SxTCIGgxMqllovv79pfsF/zc+vaxqSShyHW7oyn7hLMHM60LO/IIX1RWGL3rD9ecXx2pXXQ1RhIkVteIi13XkFt+KW00cstFlAd3EHCoY/XorShd2jeID7tpnYlmNfotYUs6IKefvpNC0PWkh5UXFEv3SUfw4Wd8O0DiHfhkrhxn1W/GajqSIlZ5DKgPzFg8EHexv8lSa7WJg0H3YQ== " ]]
45
- //phpcs:enable
46
- ];
47
- }
48
-
49
- #[DataProvider("providerTestGetGithubKeys " )]
50
- public function testGetGithubKeys (string $ username , array $ expected )
51
- {
52
- $ SITE = new UnitySite ();
53
- $ this ->assertEquals ($ expected , $ SITE ->getGithubKeys ($ username ));
54
- }
55
82
}
0 commit comments