Changeset View
Changeset View
Standalone View
Standalone View
contrib/buildbot/test/abcbot_fixture.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# | # | ||||
# Copyright (c) 2017-2020 The Bitcoin ABC developers | # Copyright (c) 2017-2020 The Bitcoin ABC developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
import base64 | import base64 | ||||
import json | import json | ||||
import hashlib | import hashlib | ||||
import hmac | import hmac | ||||
import os | import os | ||||
from pathlib import Path | from pathlib import Path | ||||
import server | import server | ||||
import shutil | import shutil | ||||
import unittest | import unittest | ||||
import test.mocks.cirrus | |||||
import test.mocks.fixture | import test.mocks.fixture | ||||
import test.mocks.phabricator | import test.mocks.phabricator | ||||
import test.mocks.slackbot | import test.mocks.slackbot | ||||
import test.mocks.teamcity | import test.mocks.teamcity | ||||
# Setup global parameters | # Setup global parameters | ||||
TEST_USER = "TESTUSER" | TEST_USER = "TESTUSER" | ||||
TEST_PASSWORD = "TESTPASSWORD" | TEST_PASSWORD = "TESTPASSWORD" | ||||
Show All 19 Lines | def __init__(self, methodName='runTest'): | ||||
self.db_file_no_ext = None | self.db_file_no_ext = None | ||||
def setUp(self): | def setUp(self): | ||||
shutil.rmtree(self.test_output_dir, ignore_errors=True) | shutil.rmtree(self.test_output_dir, ignore_errors=True) | ||||
os.makedirs(self.test_output_dir, exist_ok=True) | os.makedirs(self.test_output_dir, exist_ok=True) | ||||
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.cirrus = test.mocks.cirrus.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.cirrus, | ||||
db_file_no_ext=self.db_file_no_ext, | db_file_no_ext=self.db_file_no_ext, | ||||
jsonEncoder=test.mocks.fixture.MockJSONEncoder).test_client() | 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(), | ||||
Show All 12 Lines |