Changeset View
Changeset View
Standalone View
Standalone View
contrib/buildbot/test/abcbot_fixture.py
Show All 32 Lines | def __init__(self, methodName='runTest'): | ||||
os.environ["WEBHOOK_PASSWORD"] = TEST_PASSWORD | os.environ["WEBHOOK_PASSWORD"] = TEST_PASSWORD | ||||
os.environ["DEPLOYMENT_ENV"] = "prod" | os.environ["DEPLOYMENT_ENV"] = "prod" | ||||
self.data_dir = Path(__file__).parent / "data" | self.data_dir = Path(__file__).parent / "data" | ||||
self.credentials = base64.b64encode("{}:{}".format( | self.credentials = base64.b64encode("{}:{}".format( | ||||
TEST_USER, TEST_PASSWORD).encode()).decode('utf-8') | TEST_USER, TEST_PASSWORD).encode()).decode('utf-8') | ||||
self.headers = {'Authorization': 'Basic ' + self.credentials} | self.headers = {'Authorization': 'Basic ' + self.credentials} | ||||
self.db_file_no_ext = None | |||||
def setUp(self): | def setUp(self): | ||||
self.phab = test.mocks.phabricator.instance() | self.phab = test.mocks.phabricator.instance() | ||||
self.slackbot = test.mocks.slackbot.instance() | self.slackbot = test.mocks.slackbot.instance() | ||||
self.teamcity = test.mocks.teamcity.instance() | self.teamcity = test.mocks.teamcity.instance() | ||||
self.travis = test.mocks.travis.instance() | self.travis = test.mocks.travis.instance() | ||||
self.app = server.create_server( | self.app = server.create_server( | ||||
self.teamcity, | self.teamcity, | ||||
self.phab, | self.phab, | ||||
self.slackbot, | self.slackbot, | ||||
self.travis, | self.travis, | ||||
test.mocks.fixture.MockJSONEncoder).test_client() | db_file_no_ext=self.db_file_no_ext, | ||||
jsonEncoder=test.mocks.fixture.MockJSONEncoder).test_client() | |||||
def tearDown(self): | def tearDown(self): | ||||
pass | pass | ||||
def compute_hmac(self, data): | def compute_hmac(self, data): | ||||
return hmac.new(self.hmac_secret.encode(), | return hmac.new(self.hmac_secret.encode(), | ||||
data.encode(), hashlib.sha256).hexdigest() | data.encode(), hashlib.sha256).hexdigest() | ||||
Show All 10 Lines |