コード例 #1
0
 def test_task_without_url(
     self,
     test_browse_url: None,
     test_feature_view_mocked: FeatureView,
     column_name: str,
     value: Sequence[str],
     mocker: MockerFixture,
 ) -> None:
     assert task_formatter(
         view=test_feature_view_mocked,
         context=mocker.MagicMock(),
         model=db.Feature(**{column_name: value}),  # type: ignore
         name=column_name,
     ) == Markup(", ".join(value))
コード例 #2
0
def test_feature(faker: Faker, test_system_user: SystemUserModel,
                 test_feature_type: FeatureTypeModel) -> FeatureModel:
    with db.create_session() as session:
        feature = db.Feature(
            name=faker.word(),
            author=test_system_user.login,
            type_id=test_feature_type.id,
            task=[faker.word()[:11]],
            last_edited_by=test_system_user.login,
            file_path="my_folder/my_feature",
        )
        session.add(feature)
        session.flush()
        return cast(FeatureModel, FeatureModel.from_orm(feature))
コード例 #3
0
 def test_task_without_url(
     self,
     test_browse_url: None,
     test_feature_view_mocked: FeatureView,
     column_name: str,
     value: str,
     correct_value: str,
     mocker: MockerFixture,
 ) -> None:
     assert file_path_formatter(
         view=test_feature_view_mocked,
         context=mocker.MagicMock(),
         model=db.Feature(**{column_name: value}),  # type: ignore
         name=column_name,
     ) == Markup(f"<i>{correct_value}</i>")
コード例 #4
0
 def test_with_feature(
     self,
     test_feature_view_mocked: FeatureView,
     mocker: MockerFixture,
     column_name: str,
     test_feature_id: int,
     test_feature_name: str,
 ) -> None:
     assert feature_link_formatter(
         view=test_feature_view_mocked,
         context=mocker.MagicMock(),
         model=db.Feature(**{
             "id": test_feature_id,
             column_name: test_feature_name
         }),  # type: ignore
         name=column_name,
     ) == get_feature_link_markup(feature_id=test_feature_id,
                                  feature_name=test_feature_name)
コード例 #5
0
 def test_task_with_url(
     self,
     test_browse_url: str,
     test_feature_view_mocked: FeatureView,
     column_name: str,
     value: Sequence[str],
     mocker: MockerFixture,
 ) -> None:
     task_links = []
     for task in value:
         task_links.append(
             f"<a href='{test_browse_url}/{task}' target='blank'>{task}</a>"
         )
     assert task_formatter(
         view=test_feature_view_mocked,
         context=mocker.MagicMock(),
         model=db.Feature(**{column_name: value}),  # type: ignore
         name=column_name,
     ) == Markup(", ".join(task_links))
コード例 #6
0
 def test_with_draft(
     self,
     test_draft_view: DraftView,
     mocker: MockerFixture,
     column_name: str,
     test_feature_id: int,
     test_feature_name: str,
 ) -> None:
     assert draft_feature_formatter(
         view=test_draft_view,
         context=mocker.MagicMock(),
         model=db.Draft(
             **{
                 column_name: test_feature_id,
                 "feature": db.Feature(name=test_feature_name)
             }  # type: ignore
         ),
         name=column_name,
     ) == get_feature_link_markup(feature_id=test_feature_id,
                                  feature_name=test_feature_name)
コード例 #7
0
def test_db_scenario(test_feature_container: FeatureTestContainer,
                     test_db_user: SystemUserModel) -> ScenarioModel:
    with db.create_session() as session:
        db_feature_type = session.query(db.FeatureType).filter(
            db.FeatureType.name == test_feature_container.type).one()
        db_feature = db.Feature(
            name=test_feature_container.name,
            author=test_db_user.login,
            type_id=db_feature_type.id,
            task=["PRJ-123"],
            last_edited_by=test_db_user.login,
            file_path=test_feature_container.file_path,
        )
        session.add(db_feature)
        session.flush()
        db_scenario = db.Scenario(feature_id=db_feature.id,
                                  text=test_feature_container.scenario)
        session.add(db_scenario)
        session.flush()
        return ScenarioModel.from_orm(db_scenario)
コード例 #8
0
def test_feature_row(faker: Faker, test_feature_model_task: List[str]) -> db.Feature:
    return db.Feature(name=faker.word(), author=faker.word(), task=test_feature_model_task)