Example #1
0
def _create_topics():
    Topic.create_topic(
        'Other / Reason not listed',
        available_in_notes=True,
        available_in_appointments=True,
    )
    for index in range(10):
        true_for_both = index in [1, 5, 7]
        available_in_appointments = true_for_both or index % 2 == 0
        available_in_notes = true_for_both or index % 3 == 0
        if true_for_both:
            topic = f'Topic for all, {index}'
        elif available_in_appointments:
            topic = f'Topic for appointments, {index}'
        else:
            topic = f'Topic for notes, {index}'
        Topic.create_topic(
            topic=topic,
            available_in_appointments=available_in_appointments,
            available_in_notes=available_in_notes,
        )
    Topic.delete(
        Topic.create_topic('Topic for all, deleted',
                           available_in_appointments=True).id)
    Topic.delete(
        Topic.create_topic('Topic for appointments, deleted',
                           available_in_appointments=True).id)
    Topic.delete(
        Topic.create_topic('Topic for notes, deleted',
                           available_in_notes=True).id)
    std_commit(allow_test_environment=True)
Example #2
0
def delete_topic(topic_id):
    Topic.delete(topic_id=topic_id)
    return tolerant_jsonify({'message': f'Topic {topic_id} deleted'}), 200
Example #3
0
def create_advising_note_topics():
    for i in range(5):
        Topic.create_topic(f'Topic {i}')
    delete_me = Topic.create_topic('I am a deleted topic')
    Topic.delete(delete_me.id)
    std_commit(allow_test_environment=True)