def test_search_no_public_with_unvouched(self, PrivacyAwareSMock): result = UserProfileMappingType.search("foo", include_non_vouched=True) ok_(isinstance(result, Mock)) PrivacyAwareSMock.assert_any_call(UserProfileMappingType) PrivacyAwareSMock().indexes.assert_any_call("index") ok_(call().indexes().boost().query().order_by().filter(is_vouched=True) not in PrivacyAwareSMock.mock_calls) ok_(call().privacy_level(PUBLIC) not in PrivacyAwareSMock.mock_calls)
def test_search_no_public_only_vouched(self, PrivacyAwareSMock): result = UserProfileMappingType.search('foo') ok_(isinstance(result, Mock)) PrivacyAwareSMock.assert_any_call(UserProfileMappingType) PrivacyAwareSMock().indexes.assert_any_call('index') (PrivacyAwareSMock().indexes().boost() .query().order_by().filter.assert_any_call(is_vouched=True)) ok_(call().privacy_level(PUBLIC) not in PrivacyAwareSMock.mock_calls)
def test_search_no_public_with_unvouched(self, PrivacyAwareSMock): result = UserProfileMappingType.search('foo', include_non_vouched=True) ok_(isinstance(result, Mock)) PrivacyAwareSMock.assert_any_call(UserProfileMappingType) PrivacyAwareSMock().indexes.assert_any_call('index') ok_(call().indexes().boost().query().order_by().filter( is_vouched=True) not in PrivacyAwareSMock.mock_calls) ok_(call().privacy_level(PUBLIC) not in PrivacyAwareSMock.mock_calls)
def test_search_public_only_vouched(self, PrivacyAwareSMock): result = UserProfileMappingType.search('foo', public=True) ok_(isinstance(result, Mock)) PrivacyAwareSMock.assert_any_call(UserProfileMappingType) PrivacyAwareSMock().privacy_level.assert_any_call(PUBLIC) (PrivacyAwareSMock().privacy_level().indexes.assert_any_call( 'public_index')) (PrivacyAwareSMock().privacy_level().indexes().boost().query(). order_by().filter.assert_any_call(is_vouched=True))
def test_search_public_only_vouched(self, PrivacyAwareSMock): result = UserProfileMappingType.search("foo", public=True) ok_(isinstance(result, Mock)) PrivacyAwareSMock.assert_any_call(UserProfileMappingType) PrivacyAwareSMock().privacy_level.assert_any_call(PUBLIC) (PrivacyAwareSMock().privacy_level().indexes.assert_any_call("public_index")) ( PrivacyAwareSMock() .privacy_level() .indexes() .boost() .query() .order_by() .filter.assert_any_call(is_vouched=True) )