ci: expand CI checks and make consumer sync opt-in
- Add Go, npm, Python, and Java validation to CI - Run Go tests against PostgreSQL - Record performance fixes in the report
This commit is contained in:
1 parent
199a5efaef
commit
22887fef03
100 files changed
+9740
-429
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import unittest
|
||||
|
||||
from shared_backend.coreconfig import Info, Store
|
||||
from shared_backend.coreconfig import Info, Store, internal_secret_matches
|
||||
|
||||
|
||||
class StoreDefaultsTests(unittest.TestCase):
|
||||
@@ -62,5 +62,29 @@ class StoreSetTests(unittest.TestCase):
|
||||
self.assertEqual(info.to_json()["carrierNodeUrl"], "http://carrier.example.com")
|
||||
|
||||
|
||||
class InternalSecretTests(unittest.TestCase):
|
||||
def test_unset_or_empty_secret_never_matches(self):
|
||||
self.assertFalse(internal_secret_matches(None, None))
|
||||
self.assertFalse(internal_secret_matches(None, ""))
|
||||
self.assertFalse(internal_secret_matches("", ""))
|
||||
self.assertFalse(internal_secret_matches("", None))
|
||||
|
||||
def test_compares_the_whole_secret(self):
|
||||
self.assertTrue(internal_secret_matches("shared-secret", "shared-secret"))
|
||||
self.assertFalse(internal_secret_matches("shared-secreT", "shared-secret"))
|
||||
self.assertFalse(internal_secret_matches(None, "shared-secret"))
|
||||
|
||||
|
||||
class UrlValidationTests(unittest.TestCase):
|
||||
def test_rejects_urls_that_are_not_http_or_https_with_a_host(self):
|
||||
store = Store(Info(auth_guard_url="http://auth.example.com"))
|
||||
for bad in ["javascript:alert(1)", "auth.example.com", "ftp://carrier.example.com", "http://"]:
|
||||
with self.subTest(url=bad), self.assertRaises(ValueError):
|
||||
store.set(Info(auth_guard_url=bad))
|
||||
with self.assertRaises(ValueError):
|
||||
store.set(Info(carrier_node_urls=["http://carrier.example.com:99999"]))
|
||||
self.assertEqual(store.auth_guard_url, "http://auth.example.com")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user