moo.core.tests.test_bootstrap_sync

Tests for the idempotent bootstrap sync system.

Covers: - bootstrap.get_or_create_object() helper - bootstrap.initialize_dataset() idempotency - bootstrap.load_verbs() with replace=True - moo_init –sync management command

Functions

test_get_or_create_object_adds_parents_only_on_creation(...)

Parents are added when the object is newly created; not re-added on subsequent calls.

test_get_or_create_object_creates_on_first_call(...)

First call creates the object and returns created=True.

test_get_or_create_object_is_idempotent(...)

Second call returns the existing object without creating a duplicate.

test_initialize_dataset_is_idempotent(t_init)

Calling initialize_dataset() on an already-bootstrapped DB does not create duplicates.

test_load_verb_source_replace_true_does_not_duplicate(...)

load_verb_source() with replace=True updates in place without creating a duplicate.

test_load_verbs_replace_param_threads_through(...)

load_verbs() passes replace=True through to load_verb_source().

test_moo_init_sync_fails_on_uninitialised_db()

moo_init --sync raises RuntimeError when the dataset hasn't been initialised yet.

test_moo_init_sync_succeeds_on_existing_db(t_init)

moo_init --sync succeeds on an already-bootstrapped DB without raising.