def get_list_id(self, board_id): objlist = Lists() list_response = objlist.create_list_using_post_api(board_id) list_id = objlist.list_id(list_response) return list_id
class TestLists: @pytest.yield_fixture() def list_fixture(self): self.objlist = Lists() self.objboard = Board() self.objorganisation = Organisation() self.org_id = self.objlist.organisation() self.board_id = self.objlist.board(self.org_id) self.list_response = self.objlist.create_list_using_post_api( self.board_id) self.list_id = self.objlist.list_id(self.list_response) yield self.objboard.delete_board(self.board_id) self.objorganisation.delete_organisation(self.org_id) @pytest.mark.usefixtures('list_fixture') def test_creation_of_list(self): response = self.objlist.create_list_using_post_api(self.board_id) try: assert response.status_code == constant.test_successful except: logger.error("list not created succesfully") def test_status_code_when_name_field_is_empty(self): objlist = Lists() objboard = Board() objorganisation = Organisation() org_id = objlist.organisation() board_id = objlist.board(org_id) negative_list_response = objlist.set_name_field_empty(board_id) objboard.delete_board(board_id) objorganisation.delete_organisation(org_id) try: assert negative_list_response == constant.negative_case except: logger.error(" in list it runs with blank name input") @pytest.mark.usefixtures('list_fixture') def test_check_position_is_changed_or_not(self): changed_pos = self.objlist.create_list_using_post_api(self.list_id) actual_pos = self.objlist.position_of_the_list(self.list_response) try: assert changed_pos != actual_pos except: logger.error("in list position not changed") @pytest.mark.usefixtures('list_fixture') def test_name_is_updated_or_not(self): updated_name = self.objlist.updated_name_of_the_list(self.list_id) actual_name = self.objlist.list_name(self.list_response) try: assert updated_name != actual_name except: logger.error("list name not updated") @pytest.mark.usefixtures('list_fixture') def test_put_close_archive_the_list(self): try: assert self.objlist.close_list_by_putclose_api( self.list_id) == constant.true except: logger.error("in list request not archived") @pytest.mark.usefixtures('list_fixture') def test_softlimit_status_code_run_or_not_running(self): try: assert self.objlist.set_soft_limit_of_card(self.list_id) except: logger.error("in list softlimit cannot be updated") @pytest.mark.usefixtures('list_fixture') def test_subscription_api_status_code(self): try: assert self.objlist.subscription_detail( self.list_id) == constant.test_successful except: logger.error("in list subscription not done") @pytest.mark.usefixtures('list_fixture') def test_subscription_boolien_value_the_list_is_subscribed_or_not(self): try: assert self.objlist.get_api_to_check_sybscription_in_field( self.list_id) == constant.true except: logger.error("in list channel is not subscribed") @pytest.mark.usefixtures('list_fixture') def test_get_board_gives_information_about_board_in_which_list_is_present( self): try: assert self.objlist.get_api_check_board_information( self.list_id) == constant.test_successful except: logger.error("information cannot be fatched") @pytest.mark.usefixtures('list_fixture') def test_get_all_information_about_cards(self): try: assert self.objlist.get_list_of_card_in_a_list( self.list_id) == constant.test_successful except: logger.error("list card information cannot fetched")
class TestCard: @pytest.yield_fixture() def card_fixture(self): self.objcard = Card() self.objlist = Lists() self.objboard = Board() self.objorganisation = Organisation() self.org_id = self.objlist.organisation() self.board_id = self.objlist.board(self.org_id) self.list_response = self.objlist.create_list_using_post_api( self.board_id) self.list_id = self.objlist.list_id(self.list_response) self.card_response = self.objcard.create_card_in_list(self.list_id) self.card_id = self.objcard.get_card_id(self.card_response) yield self.objboard.delete_board(self.board_id) self.objorganisation.delete_organisation(self.org_id) @pytest.mark.usefixtures('card_fixture') def test_card_is_created_or_not(self): try: assert self.card_response.status_code == constant.test_successful except: logger.error("card not created") @pytest.mark.usefixtures('card_fixture') def test_delete_of_card_is_happened(self): try: assert self.objcard.delete_card_using_delete_api( self.card_id) == constant.test_successful except: logger.error("card not deleted") @pytest.mark.usefixtures('card_fixture') def test_action_comment_added_to_card(self): try: assert self.objcard.add_action_api_comment_on_card( self.card_id) == constant.test_successful except: logger.error("card comment not added") @pytest.mark.usefixtures('card_fixture') def test_color_change_of_card_using_label(self): try: assert self.objcard.post_change_color_of_card( self.card_id) == constant.color except: logger.error("card color not changed") @pytest.mark.usefixtures('card_fixture') def test_mark_associated_notification_read(self): try: assert self.objcard.mark_associated_notifications_read( self.card_id) == constant.test_successful except: logger.error("card notification is not readable") @pytest.mark.usefixtures('card_fixture') def test_name_updation_of_card_in_put_api(self): try: assert self.objcard.update_name_using_put( self.card_id) != self.objcard.get_card_name(self.card_response) except: logger.error("card name can not be updated ") @pytest.mark.usefixtures('card_fixture') def test_position_of_card_using_get_api(self): try: ##we also use status_code here to check api is working properly assert self.objcard.get_position_of_card_using_field( self.card_id) == constant.position except: logger.error('card position is not available') @pytest.mark.usefixtures('card_fixture') def test_list_in_which_card_is_present(self): try: assert self.objcard.get_list_in_which_card_is_present( self.card_id) == constant.test_successful except: logger.error("in card list of card not available") @pytest.mark.usefixtures('card_fixture') def test_when_name_field_is_empty(self): try: assert self.objcard.name_field_is_empty() == constant.negative_case except: logger.error("name field is not empty here")