Follow rfc 7515 and strip padding from JWS segments (#324)

* strip off illegal padding

* oops: remove unused import base64
diff --git a/tests/test__helpers.py b/tests/test__helpers.py
index b067faa..79bdef3 100644
--- a/tests/test__helpers.py
+++ b/tests/test__helpers.py
@@ -167,3 +167,15 @@
 
     for case, expected in cases:
         assert _helpers.padded_urlsafe_b64decode(case) == expected
+
+
+def test_unpadded_urlsafe_b64encode():
+    cases = [
+        (b'', b''),
+        (b'a', b'YQ'),
+        (b'aa', b'YWE'),
+        (b'aaa', b'YWFh'),
+    ]
+
+    for case, expected in cases:
+        assert _helpers.unpadded_urlsafe_b64encode(case) == expected