def setUp(self):
        self.domain = "test-domain"
        create_domain(self.domain)
        password = "****"

        def create_user(username):
            return CommCareUser.create(self.domain, format_username(username, self.domain), password)

        def create_group(name, *users):
            group = Group(users=[user.user_id for user in users], name=name, domain=self.domain,
                          case_sharing=True)
            group.save()
            return group

        self.userX = create_user("X")
        self.userA1 = create_user("A1")
        self.userA2 = create_user("A2")
        self.userB1 = create_user("B1")
        self.userB2 = create_user("B2")

        self.groupA = create_group("A", self.userX, self.userA1, self.userA2)
        self.groupB = create_group("B", self.userX, self.userB1, self.userB2)
Two groups A and B, with users A1, A2 and B1, B2 respectively, and supervisor X who belongs to both.
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/hqcase/tests/test_case_sharing.py/CaseSharingTest.setUp