def test_verify_valid_secret(self): responses.add( responses.GET, 'https://github.ibm.com/api/v3', status=200, ) assert GheDetector().verify(GHE_TOKEN) == VerifiedResult.VERIFIED_TRUE
def test_verify_status_not_200_or_401(self): responses.add( responses.GET, 'https://github.ibm.com/api/v3', status=500, ) assert GheDetector().verify(GHE_TOKEN) == VerifiedResult.UNVERIFIED
def test_verify_invalid_secret_bytes(self): responses.add( responses.GET, 'https://github.ibm.com/api/v3', status=401, ) assert GheDetector().verify( GHE_TOKEN_BYTES) == VerifiedResult.VERIFIED_FALSE
def test_analyze_line(self, payload, should_flag): logic = GheDetector() output = logic.analyze_line(payload, 1, 'mock_filename') assert len(output) == int(should_flag)
def test_verify_unverified_secret(self): assert GheDetector().verify(GHE_TOKEN) == VerifiedResult.UNVERIFIED