Add source_site_id to ActiveSite model and implement unique constraint. Update serializers and views for site registration and claiming. Enhance tests for site registration and claiming functionality.
This commit is contained in:
1 parent
521f36d22d
commit
61f954a3bd
12 files changed
+684
-172
No files matched your search
@@ -92,17 +92,22 @@ class VisibilityScopeTests(TestCase):
|
||||
self.assertEqual(response.data["results"], [])
|
||||
|
||||
def test_registering_active_site_attaches_matching_seed_site(self):
|
||||
ActiveSite.objects.create(
|
||||
code="orphan-seed",
|
||||
name="Orphan Seed",
|
||||
api_base_url="https://orphan.example/api/v1",
|
||||
api_key="k",
|
||||
managed_by=None,
|
||||
)
|
||||
self.client.force_authenticate(self.gm)
|
||||
response = self.client.post(
|
||||
"/api/v1/active-sites/",
|
||||
{
|
||||
"code": "orphan-seed",
|
||||
"name": "Orphan Seed",
|
||||
"is_active": True,
|
||||
},
|
||||
format="json",
|
||||
)
|
||||
self.assertEqual(response.status_code, 201)
|
||||
self.assertEqual(response.status_code, 200, response.data)
|
||||
self.orphan.refresh_from_db()
|
||||
self.assertEqual(self.orphan.active_site_id, response.data["id"])
|
||||
listed = self.client.get("/api/v1/sites/")
|
||||
|
||||
Reference in new issue
Block a user