[ARVADOS-WORKBENCH2] updated: 2.2.1-37-g4c35a8d1

Git user git at public.arvados.org
Mon Aug 2 18:25:43 UTC 2021


Summary of changes:
 src/validators/is-rsa-key.test.tsx | 39 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 src/validators/is-rsa-key.test.tsx

       via  4c35a8d1ba4aeda92e6be16dd389ee6189e32ad8 (commit)
      from  ac8fd68834fc706b76fa32df82346d4a3df9026e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 4c35a8d1ba4aeda92e6be16dd389ee6189e32ad8
Author: Stephen Smith <stephen at curii.com>
Date:   Mon Aug 2 14:25:10 2021 -0400

    17691: Add unit tests for isRsaKey
    
    Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>

diff --git a/src/validators/is-rsa-key.test.tsx b/src/validators/is-rsa-key.test.tsx
new file mode 100644
index 00000000..067d7744
--- /dev/null
+++ b/src/validators/is-rsa-key.test.tsx
@@ -0,0 +1,39 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { isRsaKey } from './is-rsa-key';
+
+describe('rsa-key-validator', () => {
+    const rsaKey = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDPpavAS1wUq2+j7PgwkDS+9lm43AkdGxZo+T8qm6ZcB009EUEXya3lQolA52gg/i5aGZg4LT3t1OKxbsaClMd7sNZXYrMW9vd/utvGgAlNEbE/yXsEl2kpxt8lz7RI1XLnoWcV+aKyrsiKdrMKnZyG8CBxKdtzxHzWRl4N1BGrFJf/RnUWJv2VvM/h4/O+KXIjFokPkJ1F8yQChp5OKGkBKGXQ1vV4LjXqEXGVlgiQFM4U2NvCA8hXQR8mYm1vOsTYJzoSsnb+ewbXlVH5d7XsR5S2ULOr88vuYN/P4DF/Q3pEBi7BOyee61P3eHvhCNtb+jQMt59Vj/96y5C/reTMRo2R3B4bmX+Zxr3+DCC5tO1y+U5V39fu7cweimKXc78QDGGAVN0kz4P6P137b5WkCYIozeiBvWRsbGIlHjlGu9+0WuotdluD+OrTguuZ2zr8f32ijddO6y0J+aIdmTxQPxtmcQuRtpRfquoJGLhWAJH6mNZKbWkqqVfd5BA0TYs=';
+    const badKey = 'ssh-rsa bad'
+
+    const ERROR_MESSAGE = 'Public key is invalid';
+
+    describe('rsaKeyValidation', () => {
+        it('should accept keys with comment', () => {
+            // then
+            expect(isRsaKey(rsaKey + " firstlast at example.com")).toBeUndefined();
+        });
+
+        it('should accept keys without comment', () => {
+            // then
+            expect(isRsaKey(rsaKey)).toBeUndefined();
+        });
+
+        it('should reject keys with trailing whitespace', () => {
+            // then
+            expect(isRsaKey(rsaKey + " ")).toBe(ERROR_MESSAGE);
+            expect(isRsaKey(rsaKey + "\n")).toBe(ERROR_MESSAGE);
+            expect(isRsaKey(rsaKey + "\r\n")).toBe(ERROR_MESSAGE);
+            expect(isRsaKey(rsaKey + "\t")).toBe(ERROR_MESSAGE);
+        });
+
+        it('should reject invalid keys', () => {
+            // then
+            expect(isRsaKey(badKey)).toBe(ERROR_MESSAGE);
+        });
+
+    });
+
+});

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list