def setUpClass(self): global driver, message_input, actions set_env() set_var('MOCK', 'True') application = Thread(target=run) application.daemon = True application.start() driver = webdriver.Chrome(os.environ.get("CHROME_DRIVER_PATH")) driver.get(os.environ.get("SLACK_URL")) wait = WebDriverWait(driver, 30) wait.until(EC.presence_of_element_located((By.ID, "signin_btn"))) email = driver.find_element_by_id("email") password = driver.find_element_by_id("password") email.send_keys(os.environ.get("TESTER_EMAIL")) password.send_keys(os.environ.get("TESTER_PASSWORD")) sign_in = driver.find_element_by_id("signin_btn") sign_in.click() wait.until(EC.title_contains("general")) driver.get(os.environ.get("SLACK_URL") + "messages/agilebot-test") wait.until(EC.title_contains("agilebot-test")) wait.until(EC.presence_of_element_located((By.ID, "msg_input"))) message_input = driver.find_element_by_id("msg_input") assert_is_not_none(message_input)
def test_get_commits_with_unauthorized_date(): set_env() user = '******' strdate = '02/28/2000' date = datetime.strptime(strdate, "%m/%d/%Y") from main.application.authority import should_mock if should_mock() == True: assert_true(github.get_commits(user, "", date, "") == None)
all_users = None def get_all_users(): return all_users def get_user_data(slack_client): # Populate User Data global all_users if all_users: return all_users all_users = dict() user_list = slack_client.api_call("users.list") for user in user_list['members']: if is_valid_user(user): user_id = user['id'] user_email = user['profile']['email'] user_tz = user['tz'] rally_id = get_user_info_from_email(user_email) all_users[user_email] = User(user_id, user_email, user_tz, rally_id) return all_users # Main function if __name__ == "__main__": # Initialize environment set_env() run()
def test_get_commits_with_valid_date(): set_env() user = '******' strdate = '11/11/2017' date = datetime.strptime(strdate, "%m/%d/%Y") assert_true(github.get_commits(user, "", date, "") != None)
def test_get_stories(): set_env() ralley_service.get_ungroomed_stories(None)