Esempio n. 1
0
    def test_create_simple_user_request_new_team(self):
        """
        Tests the registration of users creating new teams.

        Covers:
            partially: user.create_simple_user_request
            team.get_team_uids
        """

        uid = api.user.create_simple_user_request(new_team_user)
        assert uid == api.user.get_user(name=new_team_user["username"])[
            "uid"], "Good user created unsuccessfully."

        # user is added to a default team of their username
        team = api.team.get_team(name=new_team_user["username"])
        assert team, "Team was not created."

        team_uids = api.team.get_team_uids(team["tid"])
        assert uid in team_uids, "User was not successfully placed into the new team."

        sheep_user = new_team_user.copy()
        sheep_user["username"] = "******"

        with pytest.raises(WebException):
            api.user.create_simple_user_request(sheep_user)
            assert False, "Was able to create a new team... twice"

        sheep_user = new_team_user.copy()
        sheep_user["team-name-new"] = "noneixstent_team"

        with pytest.raises(WebException):
            api.user.create_simple_user_request(sheep_user)
            assert False, "Was able to create two users with the same username."
Esempio n. 2
0
    def test_create_user_request_new_team(self):
        """
        Tests the registration of users creating new teams.

        Covers:
            partially: user.create_user_request
            team.get_team_uids
        """

        uid = api.user.create_user_request(new_team_user)
        assert uid == api.user.get_user(
            name=new_team_user["username"]
        )["uid"], "Good user created unsuccessfully."

        team = api.team.get_team(name=new_team_user["team-name-new"])
        assert team, "Team was not created."

        team_uids = api.team.get_team_uids(team["tid"])
        assert uid in team_uids, "User was not successfully placed into the new team."

        sheep_user = new_team_user.copy()
        sheep_user["username"] = "******"

        with pytest.raises(WebException):
            api.user.create_user_request(sheep_user)
            assert False, "Was able to create a new team... twice"

        sheep_user = new_team_user.copy()
        sheep_user["team-name-new"] = "noneixstent_team"

        with pytest.raises(WebException):
            api.user.create_user_request(sheep_user)
            assert False, "Was able to create two users with the same username."