diff options
| author | Max Nanis | 2026-03-06 16:49:46 -0500 |
|---|---|---|
| committer | Max Nanis | 2026-03-06 16:49:46 -0500 |
| commit | 91d040211a4ed6e4157896256a762d3854777b5e (patch) | |
| tree | cd95922ea4257dc8d3f4e4cbe8534474709a20dc /tests/managers/thl/test_buyer.py | |
| download | generalresearch-91d040211a4ed6e4157896256a762d3854777b5e.tar.gz generalresearch-91d040211a4ed6e4157896256a762d3854777b5e.zip | |
Initial commitv3.3.4
Diffstat (limited to 'tests/managers/thl/test_buyer.py')
| -rw-r--r-- | tests/managers/thl/test_buyer.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/managers/thl/test_buyer.py b/tests/managers/thl/test_buyer.py new file mode 100644 index 0000000..69ea105 --- /dev/null +++ b/tests/managers/thl/test_buyer.py @@ -0,0 +1,25 @@ +from generalresearch.models import Source + + +class TestBuyer: + + def test( + self, + delete_buyers_surveys, + buyer_manager, + ): + + bs = buyer_manager.bulk_get_or_create(source=Source.TESTING, codes=["a", "b"]) + assert len(bs) == 2 + buyer_a = bs[0] + assert buyer_a.id is not None + bs2 = buyer_manager.bulk_get_or_create(source=Source.TESTING, codes=["a", "c"]) + assert len(bs2) == 2 + buyer_a2 = bs2[0] + buyer_c = bs2[1] + # a isn't created again + assert buyer_a == buyer_a2 + assert bs2[0].id is not None + + # and its cached + assert buyer_c.id == buyer_manager.source_code_pk[f"{Source.TESTING.value}:c"] |
