def check_for_open_dataset_agreement(context, will_or_wont): """Check the status of the open dataset agreement for an account.""" account_repo = AccountRepository(context.db) account = account_repo.get_account_by_id(context.accounts["foo"].id) agreements = [agreement.type for agreement in account.agreements] if will_or_wont == "will": assert_that(OPEN_DATASET, is_in(agreements)) elif will_or_wont == "will not": assert_that(OPEN_DATASET, not is_in(agreements)) else: raise ValueError('Valid values are only "will" or "won\'t"')
def account_deleted(context): """Ensure account no longer exists in database.""" acct_repository = AccountRepository(context.db) deleted_account = context.accounts["foo"] account_in_db = acct_repository.get_account_by_id(deleted_account.id) assert_that(account_in_db, none())
def _get_account(self, account_id): """Use account ID from decoded authentication token to get account.""" account_repository = AccountRepository(self.db) self.account = account_repository.get_account_by_id(account_id)
def get_account(context) -> Account: db = connect_to_db(context.client['DB_CONNECTION_CONFIG']) acct_repository = AccountRepository(db) account = acct_repository.get_account_by_id(context.account.id) return account