7
7
8
8
from detect_secrets .core .constants import VerifiedResult
9
9
from detect_secrets .plugins .softlayer import find_username
10
- from detect_secrets .plugins .softlayer import SoftLayerDetector
10
+ from detect_secrets .plugins .softlayer import SoftlayerDetector
11
11
12
12
13
13
SL_TOKEN = 'abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234'
14
14
15
15
16
- class TestSoftLayerDetector (object ):
16
+ class TestSoftlayerDetector (object ):
17
17
18
18
@pytest .mark .parametrize (
19
19
'payload, should_flag' ,
@@ -78,7 +78,7 @@ class TestSoftLayerDetector(object):
78
78
],
79
79
)
80
80
def test_analyze_string (self , payload , should_flag ):
81
- logic = SoftLayerDetector ()
81
+ logic = SoftlayerDetector ()
82
82
83
83
output = logic .analyze_string (payload , 1 , 'mock_filename' )
84
84
assert len (output ) == (1 if should_flag else 0 )
@@ -90,7 +90,7 @@ def test_verify_invalid_secret(self):
90
90
json = {'error' : 'Access denied. ' }, status = 401 ,
91
91
)
92
92
93
- assert SoftLayerDetector ().verify (
93
+ assert SoftlayerDetector ().verify (
94
94
SL_TOKEN ,
95
95
'softlayer_username={}' .format (SL_USERNAME ),
96
96
) == VerifiedResult .VERIFIED_FALSE
@@ -101,20 +101,20 @@ def test_verify_valid_secret(self):
101
101
responses .GET , 'https://api.softlayer.com/rest/v3/SoftLayer_Account.json' ,
102
102
json = {'id' : 1 }, status = 200 ,
103
103
)
104
- assert SoftLayerDetector ().verify (
104
+ assert SoftlayerDetector ().verify (
105
105
SL_TOKEN ,
106
106
'softlayer_username={}' .format (SL_USERNAME ),
107
107
) == VerifiedResult .VERIFIED_TRUE
108
108
109
109
@responses .activate
110
110
def test_verify_unverified_secret (self ):
111
- assert SoftLayerDetector ().verify (
111
+ assert SoftlayerDetector ().verify (
112
112
SL_TOKEN ,
113
113
'softlayer_username={}' .format (SL_USERNAME ),
114
114
) == VerifiedResult .UNVERIFIED
115
115
116
116
def test_verify_no_secret (self ):
117
- assert SoftLayerDetector ().verify (
117
+ assert SoftlayerDetector ().verify (
118
118
SL_TOKEN ,
119
119
'no_un={}' .format (SL_USERNAME ),
120
120
) == VerifiedResult .UNVERIFIED
0 commit comments