Ejemplo n.º 1
0
    class TestClass_CreateIterations(object):
        def test_get_root_iter(self):
            # Design the URL
            api = "api/spaces/" + spaceid + "/iterations"
            url = launch_detail.create_url(api)
            # Make the request
            r = req.get(url, headers=request_detail.headers_default)
            # Analyze the response
            dynamic_vars.parent_iteration_id = helpers.extract_value(
                "data[0].id", r)
            dynamic_vars.parent_iteration_name = helpers.extract_value(
                "data[0].attributes.name", r)
            # Validate the response
            r.raise_for_status()

        @pytest.mark.parametrize("iter_name",
                                 helpers.generate_entity_names(
                                     "Iteration", 2, True, reset_counter=True))
        def test_create_child_iters(self, iter_name):
            # Design the URL
            api = "api/iterations/" + dynamic_vars.parent_iteration_id
            url = launch_detail.create_url(api)
            f = helpers.read_post_data_file('create_child_iteration.json',
                                            replace={
                                                '$iteration_name_generated':
                                                iter_name,
                                                '$spaceid': spaceid
                                            })
            # Make the request
            r = req.post(url, headers=request_detail.headers_default, json=f)
            # Analyze the response
            dynamic_vars.iteration_names_to_ids[
                iter_name] = helpers.extract_value("data.id", r)
            # Validate the response
            assert r.status_code == 201

        @pytest.mark.parametrize(
            "iter_name",
            helpers.generate_entity_names("Iteration1",
                                          1,
                                          True,
                                          reset_counter=True))
        def test_create_nested_iters(self, iter_name):
            # Design the URL
            api = "api/iterations/" + dynamic_vars.iteration_names_to_ids[
                workitem_constants.iteration_1]
            url = launch_detail.create_url(api)
            f = helpers.read_post_data_file('create_child_iteration.json',
                                            replace={
                                                '$iteration_name_generated':
                                                iter_name,
                                                '$spaceid': spaceid
                                            })
            # Make the request
            r = req.post(url, headers=request_detail.headers_default, json=f)
            # Analyze the response
            dynamic_vars.nested_iters_names_to_ids[
                iter_name] = helpers.extract_value("data.id", r)
            # Validate the response
            assert r.status_code == 201
Ejemplo n.º 2
0
    class TestClass_CreateAreas(object):
        def test_get_parent_area(self):
            # Design the URL
            api = "api/spaces/" + spaceid + "/areas"
            url = launch_detail.create_url(api)
            # Make the request
            r = req.get(url, headers=request_detail.headers_default)
            # Analyze the response
            dynamic_vars.parent_area_id = helpers.extract_value(
                "data[0].id", r)
            dynamic_vars.parent_area_name = helpers.extract_value(
                "data[0].attributes.name", r)
            # Validate the response
            r.raise_for_status()

        @pytest.mark.parametrize("area_name",
                                 helpers.generate_entity_names("Area", 2))
        def test_create_child_areas(self, area_name):
            # Design the URL
            api = "api/areas/" + dynamic_vars.parent_area_id
            url = launch_detail.create_url(api)
            f = helpers.read_post_data_file(
                'create_child_area.json',
                replace={'$area_name_generated': area_name})
            # Make the request
            r = req.post(url, headers=request_detail.headers_default, json=f)
            # Analyze the response
            dynamic_vars.area_names_to_ids[area_name] = helpers.extract_value(
                "data.id", r)
            # Validate the response
            assert r.status_code == 201
Ejemplo n.º 3
0
    class TestClass_CreateWorkitems(object):
        @pytest.mark.parametrize("wi_name",
                                 helpers.generate_entity_names(
                                     "Workitem_Title", 1, reset_counter=True))
        def test_create_backlog_themes(self, wi_name):
            r = helpers.create_workitem_SCRUM(
                title=wi_name,
                spaceid=dynamic_vars.spaceid,
                witype=workitem_constants.witypetheme)
            #  Add a couple of comments to the workitem
            helpers.add_workitem_comment(
                dynamic_vars.wi_names_to_links[wi_name],
                workitem_constants.comment_1_text)
            #  Add a label to the workitem. If label doen't exist, add one
            try:
                unused = dynamic_vars.labels_names_to_ids[
                    workitem_constants.label_1]
            except KeyError:
                r, dynamic_vars.labels_names_to_ids[
                    workitem_constants.label_1] = helpers.add_workitem_label(
                        workitem_link=dynamic_vars.wi_names_to_links[wi_name],
                        label_text=workitem_constants.label_1,
                        label_id=None)
                r.raise_for_status()

        @pytest.mark.parametrize("wi_name",
                                 helpers.generate_entity_names(
                                     "Workitem_Title", 1))
        def test_create_backlog_epics(self, wi_name):
            r = helpers.create_workitem_SCRUM(
                title=wi_name,
                spaceid=dynamic_vars.spaceid,
                witype=workitem_constants.witypeepic)
            #  Add a couple of comments to the workitem
            helpers.add_workitem_comment(
                dynamic_vars.wi_names_to_links[wi_name],
                workitem_constants.comment_1_text)
            #  Add a label to the workitem. If label doen't exist, add one
            try:
                unused = dynamic_vars.labels_names_to_ids[
                    workitem_constants.label_2]
            except KeyError:
                r, dynamic_vars.labels_names_to_ids[
                    workitem_constants.label_2] = helpers.add_workitem_label(
                        workitem_link=dynamic_vars.wi_names_to_links[wi_name],
                        label_text=workitem_constants.label_2,
                        label_id=None)
                r.raise_for_status()

        @pytest.mark.parametrize("wi_name",
                                 helpers.generate_entity_names(
                                     "Workitem_Title", 1))
        def test_create_backlog_story(self, wi_name):
            r = helpers.create_workitem_SCRUM(
                title=wi_name,
                spaceid=dynamic_vars.spaceid,
                witype=workitem_constants.witypestory)
            #  Add a couple of comments to the workitem
            helpers.add_workitem_comment(
                dynamic_vars.wi_names_to_links[wi_name],
                workitem_constants.comment_1_text)
            #  Add a label to the workitem
            try:
                used = dynamic_vars.labels_names_to_ids[
                    workitem_constants.label_2]
                if used:
                    r = helpers.add_workitem_label(
                        workitem_link=dynamic_vars.wi_names_to_links[wi_name],
                        label_text=workitem_constants.label_2,
                        label_id=used)[0]
            except KeyError:
                r, dynamic_vars.labels_names_to_ids[
                    workitem_constants.label_2] = helpers.add_workitem_label(
                        workitem_link=dynamic_vars.wi_names_to_links[wi_name],
                        label_text=workitem_constants.label_2,
                        label_id=None)
            finally:
                r.raise_for_status()

        @pytest.mark.parametrize("wi_name",
                                 helpers.generate_entity_names(
                                     "Workitem_Title", 1))
        def test_create_backlog_defects(self, wi_name):
            r = helpers.create_workitem_SCRUM(
                title=wi_name,
                spaceid=dynamic_vars.spaceid,
                witype=workitem_constants.witypedefect)
            #  Add a couple of comments to the workitem
            helpers.add_workitem_comment(
                dynamic_vars.wi_names_to_links[wi_name],
                workitem_constants.comment_1_text)
            #  Add a label to the workitem
            try:
                used = dynamic_vars.labels_names_to_ids[
                    workitem_constants.label_2]
                if used:
                    r = helpers.add_workitem_label(
                        workitem_link=dynamic_vars.wi_names_to_links[wi_name],
                        label_text=workitem_constants.label_2,
                        label_id=used)[0]
            except KeyError:
                r, dynamic_vars.labels_names_to_ids[
                    workitem_constants.label_2] = helpers.add_workitem_label(
                        workitem_link=dynamic_vars.wi_names_to_links[wi_name],
                        label_text=workitem_constants.label_2,
                        label_id=None)
            finally:
                r.raise_for_status()

        @pytest.mark.parametrize("wi_name",
                                 helpers.generate_entity_names(
                                     "Workitem_Title", 1))
        def test_create_backlog_tasks(self, wi_name):
            r = helpers.create_workitem_SCRUM(
                title=wi_name,
                spaceid=dynamic_vars.spaceid,
                witype=workitem_constants.witypetask1)
            #  Add a couple of comments to the workitem
            helpers.add_workitem_comment(
                dynamic_vars.wi_names_to_links[wi_name],
                workitem_constants.comment_1_text)
            #  Add a label to the workitem
            try:
                used = dynamic_vars.labels_names_to_ids[
                    workitem_constants.label_2]
                if used:
                    r = helpers.add_workitem_label(
                        workitem_link=dynamic_vars.wi_names_to_links[wi_name],
                        label_text=workitem_constants.label_2,
                        label_id=used)[0]
            except KeyError:
                r, dynamic_vars.labels_names_to_ids[
                    workitem_constants.label_2] = helpers.add_workitem_label(
                        workitem_link=dynamic_vars.wi_names_to_links[wi_name],
                        label_text=workitem_constants.label_2,
                        label_id=None)
            finally:
                r.raise_for_status()
Ejemplo n.º 4
0
    class TestClass_CreateWorkitems(object):
        @pytest.mark.parametrize("wi_name",
                                 helpers.generate_entity_names(
                                     "Workitem_Title", 1))
        def test_create_backlog_scenarios(self, wi_name):
            r = helpers.create_workitem_SDD(
                title=wi_name,
                spaceid=dynamic_vars.spaceid,
                witype=workitem_constants.witypescenario)
            # Add a couple of comments to the workitem
            helpers.add_workitem_comment(
                dynamic_vars.wi_names_to_links[wi_name],
                workitem_constants.comment_1_text)
            # Add a label to the workitem. If label doen't exist, add one
            try:
                unused = dynamic_vars.labels_names_to_ids[
                    workitem_constants.label_1]
            except KeyError:
                r, dynamic_vars.labels_names_to_ids[
                    workitem_constants.label_1] = helpers.add_workitem_label(
                        workitem_link=dynamic_vars.wi_names_to_links[wi_name],
                        label_text=workitem_constants.label_1,
                        label_id=None)
                r.raise_for_status()

        @pytest.mark.parametrize("wi_name",
                                 helpers.generate_entity_names(
                                     "Workitem_Title", 1))
        def test_create_backlog_experiences(self, wi_name):
            r = helpers.create_workitem_SDD(
                title=wi_name,
                spaceid=dynamic_vars.spaceid,
                witype=workitem_constants.witypeexperience)
            # Add a couple of comments to the workitem
            helpers.add_workitem_comment(
                dynamic_vars.wi_names_to_links[wi_name],
                workitem_constants.comment_1_text)
            # Add a label to the workitem
            try:
                unused = dynamic_vars.labels_names_to_ids[
                    workitem_constants.label_2]
            except KeyError:
                r, dynamic_vars.labels_names_to_ids[
                    workitem_constants.label_2] = helpers.add_workitem_label(
                        workitem_link=dynamic_vars.wi_names_to_links[wi_name],
                        label_text=workitem_constants.label_2,
                        label_id=None)
                r.raise_for_status()

        @pytest.mark.parametrize("wi_name",
                                 helpers.generate_entity_names(
                                     "Workitem_Title", 1))
        def test_create_backlog_features(self, wi_name):
            r = helpers.create_workitem_SDD(
                title=wi_name,
                spaceid=dynamic_vars.spaceid,
                witype=workitem_constants.witypefeature)
            # Add a couple of comments to the workitem
            helpers.add_workitem_comment(
                dynamic_vars.wi_names_to_links[wi_name],
                workitem_constants.comment_1_text)
            # Add a few labels to the workitem
            helpers.add_workitem_label(
                workitem_link=dynamic_vars.wi_names_to_links[wi_name],
                label_id=[
                    dynamic_vars.labels_names_to_ids[
                        workitem_constants.label_1],
                    dynamic_vars.labels_names_to_ids[
                        workitem_constants.label_2]
                ])

        @pytest.mark.parametrize("wi_name",
                                 helpers.generate_entity_names(
                                     "Workitem_Title", 1))
        def test_create_backlog_tasks(self, wi_name):
            r = helpers.create_workitem_SDD(
                title=wi_name,
                spaceid=dynamic_vars.spaceid,
                witype=workitem_constants.witypetask)
            # Add a couple of comments to the workitem
            helpers.add_workitem_comment(
                dynamic_vars.wi_names_to_links[wi_name],
                workitem_constants.comment_1_text)
            # Add a few labels to the workitem
            helpers.add_workitem_label(
                workitem_link=dynamic_vars.wi_names_to_links[wi_name],
                label_id=[
                    dynamic_vars.labels_names_to_ids[
                        workitem_constants.label_1],
                    dynamic_vars.labels_names_to_ids[
                        workitem_constants.label_2]
                ])
Ejemplo n.º 5
0
class TestClass_CreateWorkitems(object):
    ##Create workitems in Iteration-1
    @pytest.mark.parametrize("wi_name",
                             helpers.generate_entity_names("Workitem_Title",
                                                           2,
                                                           reset_counter=True))
    def test_create_iter1_workitems(self, wi_name):
        r = helpers.create_workitem(
            title=wi_name,
            spaceid=dynamic_vars.spaceid,
            witype=workitem_constants.witypetask,
            iterationid=dynamic_vars.nested_iters_names_to_ids[
                workitem_constants.iteration1_1])
        ##Validate the response
        assert r.status_code == 201

    ##Create workitems in Iteration-2
    @pytest.mark.parametrize("wi_name",
                             helpers.generate_entity_names(
                                 "Workitem_Title", 2))
    def test_create_iter2_workitems(self, wi_name):
        r = helpers.create_workitem(
            title=wi_name,
            spaceid=dynamic_vars.spaceid,
            witype=workitem_constants.witypetask,
            iterationid=dynamic_vars.iteration_names_to_ids[
                workitem_constants.iteration_2])
        ##Validate the response
        assert r.status_code == 201

    @pytest.mark.parametrize("wi_name",
                             helpers.generate_entity_names(
                                 "Workitem_Title", 2))
    def test_create_backlog_scenarios(self, wi_name):
        r = helpers.create_workitem(title=wi_name,
                                    spaceid=dynamic_vars.spaceid,
                                    witype=workitem_constants.witypescenario)
        ## Add a couple of comments to the workitem
        helpers.add_workitem_comment(dynamic_vars.wi_names_to_links[wi_name],
                                     workitem_constants.comment_1_text)
        helpers.add_workitem_comment(dynamic_vars.wi_names_to_links[wi_name],
                                     workitem_constants.comment_2_text)
        ## Add a label to the workitem. If label doen't exist, add one
        try:
            unused = dynamic_vars.labels_names_to_ids[
                workitem_constants.label_1]
        except KeyError:
            r, dynamic_vars.labels_names_to_ids[
                workitem_constants.label_1] = helpers.add_workitem_label(
                    workitem_link=dynamic_vars.wi_names_to_links[wi_name],
                    label_text=workitem_constants.label_1,
                    label_id=None)
            r.raise_for_status()

    @pytest.mark.parametrize("wi_name",
                             helpers.generate_entity_names(
                                 "Workitem_Title", 2))
    def test_create_backlog_fundamentals(self, wi_name):
        r = helpers.create_workitem(
            title=wi_name,
            spaceid=dynamic_vars.spaceid,
            witype=workitem_constants.witypefundamental)
        ## Add a couple of comments to the workitem
        helpers.add_workitem_comment(dynamic_vars.wi_names_to_links[wi_name],
                                     workitem_constants.comment_1_text)
        helpers.add_workitem_comment(dynamic_vars.wi_names_to_links[wi_name],
                                     workitem_constants.comment_2_text)
        ## Add a label to the workitem
        try:
            unused = dynamic_vars.labels_names_to_ids[
                workitem_constants.label_2]
        except KeyError:
            r, dynamic_vars.labels_names_to_ids[
                workitem_constants.label_2] = helpers.add_workitem_label(
                    workitem_link=dynamic_vars.wi_names_to_links[wi_name],
                    label_text=workitem_constants.label_2,
                    label_id=None)
            r.raise_for_status()

    @pytest.mark.parametrize("wi_name",
                             helpers.generate_entity_names(
                                 "Workitem_Title", 2))
    def test_create_backlog_papercuts(self, wi_name):
        r = helpers.create_workitem(title=wi_name,
                                    spaceid=dynamic_vars.spaceid,
                                    witype=workitem_constants.witypepapercut)
        ## Add a couple of comments to the workitem
        helpers.add_workitem_comment(dynamic_vars.wi_names_to_links[wi_name],
                                     workitem_constants.comment_1_text)
        helpers.add_workitem_comment(dynamic_vars.wi_names_to_links[wi_name],
                                     workitem_constants.comment_2_text)
        ## Add a label to the workitem
        try:
            unused = dynamic_vars.labels_names_to_ids[
                workitem_constants.label_3]
        except KeyError:
            r, dynamic_vars.labels_names_to_ids[
                workitem_constants.label_3] = helpers.add_workitem_label(
                    workitem_link=dynamic_vars.wi_names_to_links[wi_name],
                    label_text=workitem_constants.label_3,
                    label_id=None)
            r.raise_for_status()

    @pytest.mark.parametrize("wi_name",
                             helpers.generate_entity_names(
                                 "Workitem_Title", 2))
    def test_create_backlog_valueprops(self, wi_name):
        r = helpers.create_workitem(title=wi_name,
                                    spaceid=dynamic_vars.spaceid,
                                    witype=workitem_constants.witypevalue)
        ## Add a couple of comments to the workitem
        helpers.add_workitem_comment(dynamic_vars.wi_names_to_links[wi_name],
                                     workitem_constants.comment_1_text)
        helpers.add_workitem_comment(dynamic_vars.wi_names_to_links[wi_name],
                                     workitem_constants.comment_2_text)
        ## Add a label to the workitem
        try:
            unused = dynamic_vars.labels_names_to_ids[
                workitem_constants.label_4]
        except KeyError:
            r, dynamic_vars.labels_names_to_ids[
                workitem_constants.label_4] = helpers.add_workitem_label(
                    workitem_link=dynamic_vars.wi_names_to_links[wi_name],
                    label_text=workitem_constants.label_4,
                    label_id=None)
            r.raise_for_status()

    @pytest.mark.parametrize("wi_name",
                             helpers.generate_entity_names(
                                 "Workitem_Title", 2))
    def test_create_backlog_experiences(self, wi_name):
        r = helpers.create_workitem(title=wi_name,
                                    spaceid=dynamic_vars.spaceid,
                                    witype=workitem_constants.witypeexperience)
        ## Add a couple of comments to the workitem
        helpers.add_workitem_comment(dynamic_vars.wi_names_to_links[wi_name],
                                     workitem_constants.comment_1_text)
        helpers.add_workitem_comment(dynamic_vars.wi_names_to_links[wi_name],
                                     workitem_constants.comment_2_text)
        ## Add a label to the workitem
        try:
            unused = dynamic_vars.labels_names_to_ids[
                workitem_constants.label_5]
        except KeyError:
            r, dynamic_vars.labels_names_to_ids[
                workitem_constants.label_5] = helpers.add_workitem_label(
                    workitem_link=dynamic_vars.wi_names_to_links[wi_name],
                    label_text=workitem_constants.label_5,
                    label_id=None)
            r.raise_for_status()

    @pytest.mark.parametrize("wi_name",
                             helpers.generate_entity_names(
                                 "Workitem_Title", 2))
    def test_create_backlog_bugs(self, wi_name):
        r = helpers.create_workitem(title=wi_name,
                                    spaceid=dynamic_vars.spaceid,
                                    witype=workitem_constants.witypebug)
        ## Add a couple of comments to the workitem
        helpers.add_workitem_comment(dynamic_vars.wi_names_to_links[wi_name],
                                     workitem_constants.comment_1_text)
        helpers.add_workitem_comment(dynamic_vars.wi_names_to_links[wi_name],
                                     workitem_constants.comment_2_text)
        ## Add a few labels to the workitem
        helpers.add_workitem_label(
            workitem_link=dynamic_vars.wi_names_to_links[wi_name],
            label_id=[
                dynamic_vars.labels_names_to_ids[workitem_constants.label_1],
                dynamic_vars.labels_names_to_ids[workitem_constants.label_2],
                dynamic_vars.labels_names_to_ids[workitem_constants.label_3]
            ])

    @pytest.mark.parametrize("wi_name",
                             helpers.generate_entity_names(
                                 "Workitem_Title", 2))
    def test_create_backlog_features(self, wi_name):
        r = helpers.create_workitem(title=wi_name,
                                    spaceid=dynamic_vars.spaceid,
                                    witype=workitem_constants.witypefeature)
        ## Add a couple of comments to the workitem
        helpers.add_workitem_comment(dynamic_vars.wi_names_to_links[wi_name],
                                     workitem_constants.comment_1_text)
        helpers.add_workitem_comment(dynamic_vars.wi_names_to_links[wi_name],
                                     workitem_constants.comment_2_text)
        ### Add a few labels to the workitem
        helpers.add_workitem_label(
            workitem_link=dynamic_vars.wi_names_to_links[wi_name],
            label_id=[
                dynamic_vars.labels_names_to_ids[workitem_constants.label_1],
                dynamic_vars.labels_names_to_ids[workitem_constants.label_2],
                dynamic_vars.labels_names_to_ids[workitem_constants.label_3]
            ])

    @pytest.mark.parametrize("wi_name",
                             helpers.generate_entity_names(
                                 "Workitem_Title", 2))
    def test_create_backlog_tasks(self, wi_name):
        r = helpers.create_workitem(title=wi_name,
                                    spaceid=dynamic_vars.spaceid,
                                    witype=workitem_constants.witypetask)
        ## Add a couple of comments to the workitem
        helpers.add_workitem_comment(dynamic_vars.wi_names_to_links[wi_name],
                                     workitem_constants.comment_1_text)
        helpers.add_workitem_comment(dynamic_vars.wi_names_to_links[wi_name],
                                     workitem_constants.comment_2_text)
        ## Add a few labels to the workitem
        helpers.add_workitem_label(
            workitem_link=dynamic_vars.wi_names_to_links[wi_name],
            label_id=[
                dynamic_vars.labels_names_to_ids[workitem_constants.label_1],
                dynamic_vars.labels_names_to_ids[workitem_constants.label_2],
                dynamic_vars.labels_names_to_ids[workitem_constants.label_3]
            ])

    def test_create_wi5_wi11_link(self):
        r = helpers.add_workitem_parent_link("Workitem_Title_5",
                                             "Workitem_Title_11")
        ##Validate the response
        assert r.status_code == 201

    def test_create_wi11_wi17_link(self):
        r = helpers.add_workitem_parent_link("Workitem_Title_11",
                                             "Workitem_Title_17")
        ##Validate the response
        assert r.status_code == 201

    def test_create_wi17_wi19_link(self):
        r = helpers.add_workitem_parent_link("Workitem_Title_17",
                                             "Workitem_Title_19")
        ##Validate the response
        assert r.status_code == 201

    def test_create_wi7_wi13_link(self):
        r = helpers.add_workitem_parent_link("Workitem_Title_7",
                                             "Workitem_Title_13")
        ##Validate the response
        assert r.status_code == 201

    def test_create_wi13_wi15_link(self):
        r = helpers.add_workitem_parent_link("Workitem_Title_13",
                                             "Workitem_Title_15")
        ##Validate the response
        assert r.status_code == 201