Пример #1
0
    def test_can_create_empty_team(self):
        team = TeamFactory.create()

        retrieved = Team.objects(id=team.id)
        expect(retrieved.count()).to_equal(1)
        expect(retrieved.first().name).to_equal(team.name)

        expect(retrieved.first().owner.id).to_equal(team.owner.id)
Пример #2
0
    def test_can_create_empty_team(self):
        team = TeamFactory.create()

        retrieved = Team.objects(id=team.id)
        expect(retrieved.count()).to_equal(1)
        expect(retrieved.first().name).to_equal(team.name)

        expect(retrieved.first().owner.id).to_equal(team.owner.id)
Пример #3
0
    def test_can_create_team_with_members(self):
        team = TeamFactory.create()
        TeamFactory.add_members(team, 1)

        retrieved = Team.objects(id=team.id)
        expect(retrieved.count()).to_equal(1)
        expect(retrieved.first().name).to_equal(team.name)
        expect(retrieved.first().members).to_length(1)
        expect(retrieved.first().members[0].email).to_equal(team.members[0].email)
Пример #4
0
    def test_can_create_team_with_members(self):
        team = TeamFactory.create()
        TeamFactory.add_members(team, 1)

        retrieved = Team.objects(id=team.id)
        expect(retrieved.count()).to_equal(1)
        expect(retrieved.first().name).to_equal(team.name)
        expect(retrieved.first().members).to_length(1)
        expect(retrieved.first().members[0].email).to_equal(
            team.members[0].email)
Пример #5
0
    def get(self, name):
        user = {'user': {'email': self.current_user.email, 'teams': []}}
        teams = Team.objects(Q(members__contains=self.current_user) | Q(owner=self.current_user))

        for team in teams:
            role = 'owner' if team.owner == self.current_user else 'member'
            user['user']['teams'].append({'name': team.name, 'role': role})

        self.content_type = 'application/json'
        self.write(dumps(user))
        self.finish()
Пример #6
0
 def get(self, team_name, project_name, module, class_name, test_name):
     self.set_status(200)
     try:
         team = Team.objects(name=team_name).first()
         results = LoadTest.get_same_results_for_all_load_tests_from_project(team, project_name, module, class_name, test_name)
         response = []
         for result in results:
             response.append(result.to_dict())
         self.write(dumps(response))
     except DoesNotExist:
         self.set_status(404)
     finally:
         self.finish()
Пример #7
0
    def get(self, name):
        user = {'user': {'email': self.current_user.email, 'teams': []}}
        teams = Team.objects(
            Q(members__contains=self.current_user)
            | Q(owner=self.current_user))

        for team in teams:
            role = 'owner' if team.owner == self.current_user else 'member'
            user['user']['teams'].append({'name': team.name, 'role': role})

        self.content_type = 'application/json'
        self.write(dumps(user))
        self.finish()
Пример #8
0
 def get(self, team_name, project_name, module, class_name, test_name):
     self.set_status(200)
     try:
         team = Team.objects(name=team_name).first()
         results = LoadTest.get_same_results_for_all_load_tests_from_project(
             team, project_name, module, class_name, test_name)
         response = []
         for result in results:
             response.append(result.to_dict())
         self.write(dumps(response))
     except DoesNotExist:
         self.set_status(404)
     finally:
         self.finish()