Skip to content

Commit

Permalink
SoftLayer -> Softlayer
Browse files Browse the repository at this point in the history
  • Loading branch information
Xianjun Zhu committed Oct 18, 2019
1 parent 25889a1 commit 2d841c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions detect_secrets/plugins/softlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from detect_secrets.core.constants import VerifiedResult


class SoftLayerDetector(RegexBasedDetector):
class SoftlayerDetector(RegexBasedDetector):
"""Scans for Softlayer credentials."""

secret_type = 'SoftLayer Credentials'
Expand Down Expand Up @@ -48,7 +48,7 @@ def find_username(content):
username = r'(\w(?:\w|_|@|\.|-)+)'
regex = re.compile(
RegexBasedDetector.assign_regex_generator(
prefix_regex=SoftLayerDetector.sl,
prefix_regex=SoftlayerDetector.sl,
password_keyword_regex=username_keyword,
password_regex=username,
),
Expand Down
14 changes: 7 additions & 7 deletions tests/plugins/softlayer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

from detect_secrets.core.constants import VerifiedResult
from detect_secrets.plugins.softlayer import find_username
from detect_secrets.plugins.softlayer import SoftLayerDetector
from detect_secrets.plugins.softlayer import SoftlayerDetector

SL_USERNAME = '[email protected]'
SL_TOKEN = 'abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234'


class TestSoftLayerDetector(object):
class TestSoftlayerDetector(object):

@pytest.mark.parametrize(
'payload, should_flag',
Expand Down Expand Up @@ -78,7 +78,7 @@ class TestSoftLayerDetector(object):
],
)
def test_analyze_string(self, payload, should_flag):
logic = SoftLayerDetector()
logic = SoftlayerDetector()

output = logic.analyze_string(payload, 1, 'mock_filename')
assert len(output) == (1 if should_flag else 0)
Expand All @@ -90,7 +90,7 @@ def test_verify_invalid_secret(self):
json={'error': 'Access denied. '}, status=401,
)

assert SoftLayerDetector().verify(
assert SoftlayerDetector().verify(
SL_TOKEN,
'softlayer_username={}'.format(SL_USERNAME),
) == VerifiedResult.VERIFIED_FALSE
Expand All @@ -101,20 +101,20 @@ def test_verify_valid_secret(self):
responses.GET, 'https://api.softlayer.com/rest/v3/SoftLayer_Account.json',
json={'id': 1}, status=200,
)
assert SoftLayerDetector().verify(
assert SoftlayerDetector().verify(
SL_TOKEN,
'softlayer_username={}'.format(SL_USERNAME),
) == VerifiedResult.VERIFIED_TRUE

@responses.activate
def test_verify_unverified_secret(self):
assert SoftLayerDetector().verify(
assert SoftlayerDetector().verify(
SL_TOKEN,
'softlayer_username={}'.format(SL_USERNAME),
) == VerifiedResult.UNVERIFIED

def test_verify_no_secret(self):
assert SoftLayerDetector().verify(
assert SoftlayerDetector().verify(
SL_TOKEN,
'no_un={}'.format(SL_USERNAME),
) == VerifiedResult.UNVERIFIED
Expand Down

0 comments on commit 2d841c7

Please sign in to comment.