Example #1
0
def test_create_task_product(session, keycloak_mock):  # pylint:disable=unused-argument
    """Assert that a task can be created."""
    user = factory_user_model()
    test_org = factory_org_model()
    test_product = factory_product_model(org_id=test_org.id)
    product: ProductCodeModel = ProductCodeModel.find_by_code(
        test_product.product_code)
    test_task_info = {
        'name': test_org.name,
        'relationshipId': test_product.id,
        'relatedTo': user.id,
        'dateSubmitted': datetime.today(),
        'relationshipType': TaskRelationshipType.PRODUCT.value,
        'type': product.description,
        'status': [TaskStatus.OPEN.value],
        'accountId': test_org.id,
        'relationship_status':
        TaskRelationshipStatus.PENDING_STAFF_REVIEW.value
    }
    task = TaskService.create_task(test_task_info)
    assert task
    dictionary = task.as_dict()
    assert dictionary['name'] == test_task_info['name']
    assert dictionary['account_id'] == test_org.id
    assert dictionary[
        'relationship_type'] == TaskRelationshipType.PRODUCT.value
Example #2
0
def test_create_task_org(session, keycloak_mock):  # pylint:disable=unused-argument
    """Assert that a task can be created."""
    user = factory_user_model()
    test_org = factory_org_model()
    task_type_new_account = TaskTypePrefix.NEW_ACCOUNT_STAFF_REVIEW.value
    test_task_info = {
        'name': test_org.name,
        'relationshipId': test_org.id,
        'relatedTo': user.id,
        'dateSubmitted': datetime.today(),
        'relationshipType': TaskRelationshipType.ORG.value,
        'type': task_type_new_account,
        'status': TaskStatus.OPEN.value,
        'relationship_status':
        TaskRelationshipStatus.PENDING_STAFF_REVIEW.value
    }
    task = TaskService.create_task(test_task_info)
    assert task
    dictionary = task.as_dict()
    assert dictionary['name'] == test_org.name