def setUp(self): self.mox = mox.Mox() self.cnxn = fake.MonorailConnection() self.services = service_manager.Services( config=fake.ConfigService(), issue=fake.IssueService(), user=fake.UserService(), user_star=fake.UserStarService(), usergroup=fake.UserGroupService(), project=fake.ProjectService(), project_star=fake.ProjectStarService(), features=fake.FeaturesService()) self.project = self.services.project.TestAddProject('proj', project_id=987) self.user = self.services.user.TestAddUser('*****@*****.**', 111) self.user_2 = self.services.user.TestAddUser('*****@*****.**', 222) self.group1_id = self.services.usergroup.CreateGroup( self.cnxn, self.services, '*****@*****.**', 'anyone') self.group2_id = self.services.usergroup.CreateGroup( self.cnxn, self.services, '*****@*****.**', 'anyone') self.services.usergroup.UpdateMembers(self.cnxn, self.group1_id, [111], 'member') self.services.usergroup.UpdateMembers(self.cnxn, self.group2_id, [222, 111], 'owner') self.users_svcr = users_servicer.UsersServicer(self.services, make_rate_limiter=False) self.prpc_context = context.ServicerContext() self.prpc_context.set_code(codes.StatusCode.OK)
def setUp(self): self.services = service_manager.Services( project=fake.ProjectService(), user=fake.UserService(), project_star=fake.ProjectStarService(), user_star=fake.UserStarService()) self.services.project.TestAddProject('proj', project_id=123) self.services.user.TestAddUser('testuser', 111L) self.set_stars_feed = stars.SetStarsFeed('req', 'res', services=self.services)
def setUp(self): self.services = service_manager.Services( project=fake.ProjectService(), user_star=fake.UserStarService()) self.user_id = 2 self.project_id = 987 self.project = self.services.project.TestAddProject( 'proj', project_id=self.project_id) self.mr = testing_helpers.MakeMonorailRequest(services=self.services, project=self.project) self.mr.cnxn = 'fake cnxn' self.mr.viewed_user_auth.user_id = 100 self.mox = mox.Mox()
def setUp(self): self.patcher_1 = mock.patch( 'framework.framework_helpers.UserSettings.GatherUnifiedSettingsPageData' ) self.mock_guspd = self.patcher_1.start() self.mock_guspd.return_value = {'unified': None} services = service_manager.Services( project=fake.ProjectService(), user=fake.UserService(), usergroup=fake.UserGroupService(), project_star=fake.ProjectStarService(), user_star=fake.UserStarService()) self.servlet = userprofile.UserProfile('req', 'res', services=services) for user_id in (REGULAR_USER_ID, ADMIN_USER_ID, OTHER_USER_ID): services.user.TestAddUser('*****@*****.**' % user_id, user_id) for user in ['regular', 'other']: for relation in ['owner', 'member']: for state_name, state in STATES.items(): services.project.TestAddProject( '%s-%s-%s' % (user, relation, state_name), state=state) # Add projects for state_name, state in STATES.items(): services.project.TestAddProject('regular-owner-%s' % state_name, state=state, owner_ids=[REGULAR_USER_ID]) services.project.TestAddProject('regular-member-%s' % state_name, state=state, committer_ids=[REGULAR_USER_ID]) services.project.TestAddProject('other-owner-%s' % state_name, state=state, owner_ids=[OTHER_USER_ID]) services.project.TestAddProject('other-member-%s' % state_name, state=state, committer_ids=[OTHER_USER_ID]) self.regular_user = services.user.GetUser('fake cnxn', REGULAR_USER_ID) self.admin_user = services.user.GetUser('fake cnxn', ADMIN_USER_ID) self.admin_user.is_site_admin = True self.other_user = services.user.GetUser('fake cnxn', OTHER_USER_ID) self.testbed = testbed.Testbed() self.testbed.activate() self.testbed.init_memcache_stub() self.testbed.init_datastore_v3_stub()