Skip to content

Commit

Permalink
Square OAuth plugin test
Browse files Browse the repository at this point in the history
  • Loading branch information
pablosnt committed Jan 5, 2021
1 parent 5695812 commit 6cee637
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion detect_secrets/plugins/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ class BasicOAuthDetector(RegexBasedDetector):
secret_type = 'Square OAuth Secret'

denylist = [
re.compile(r'sq0csp-[0-9A-Za-z\\-_]{43}'),
re.compile(r'sq0csp-[0-9A-Za-z\\\-_]{43}'),
]
16 changes: 16 additions & 0 deletions tests/plugins/oauth_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import pytest

from detect_secrets.plugins.oauth import BasicOAuthDetector


class TestBasicOauthDetector:

@pytest.mark.parametrize(
'payload',
(
'square_oauth = sq0csp-ABCDEFGHIJK_LMNOPQRSTUVWXYZ-0123456789\\abcd',
),
)
def test_analyze(self, payload):
logic = BasicOAuthDetector()
assert logic.analyze_line(filename='mock_filename', line=payload)

0 comments on commit 6cee637

Please sign in to comment.