示例#1
0
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"')
示例#2
0
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())
示例#3
0
 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)
示例#4
0
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