Beispiel #1
0
def test_add_remove_tags(tags_model):
    original_tags = [Tag("a"), Tag("b")]
    tags_model.set_entity_tags(OBJECT_ID, original_tags)

    tags = [Tag("b"), Tag("c")]
    tags_model.set_entity_tags(OBJECT_ID, tags)

    saved_tags = tags_model.get_entity_tags(OBJECT_ID)
    assert tags == saved_tags
Beispiel #2
0
def create_issue(name="Dummy issue",
                 status=IssueStatus.open,
                 type=IssueType.bug,
                 priority=IssuePriority.critical,
                 description="Description issue",
                 date_opened=datetime(year=2019,
                                      month=1,
                                      day=1,
                                      hour=10,
                                      minute=30,
                                      second=5),
                 date_closed=datetime(year=2019,
                                      month=1,
                                      day=2,
                                      hour=10,
                                      minute=30,
                                      second=5),
                 deadline=datetime(year=2019,
                                   month=1,
                                   day=3,
                                   hour=10,
                                   minute=30,
                                   second=5),
                 estimated_duration=Decimal(10),
                 external_type="external_type",
                 files=None,
                 links=None,
                 tags=None,
                 tasks=None,
                 hour_rate=None):
    if files is None:
        files = [File("File1"), File("File2")]
    if links is None:
        links = [create_link(), create_link("www.zoho.cz", "zoho", "zoho")]
    if tags is None:
        tags = [Tag("X"), Tag("Y")]
    if tasks is None:
        tasks = [create_task(), create_task("Task", True)]
    return Issue(
        name=name,
        status=status,
        type_=type,
        priority=priority,
        description=description,
        date_opened=date_opened,
        date_closed=date_closed,
        deadline=deadline,
        estimated_duration=estimated_duration,
        external_type=external_type,
        files=files,
        links=links,
        tags=tags,
        tasks=tasks,
        hour_rate=hour_rate,
    )
Beispiel #3
0
def create_tag(tag):
    return Tag(tag)
Beispiel #4
0
def test_add_tags(tags_model):
    tags = [Tag("a"), Tag("b")]
    tags_model.set_entity_tags(OBJECT_ID, tags)
    saved_tags = tags_model.get_entity_tags(OBJECT_ID)
    assert tags == saved_tags
Beispiel #5
0
def test_duplicate_tags(tags_model):
    tags = [Tag("a"), Tag("a")]
    with pytest.raises(DuplicateTagReceived):
        tags_model.set_entity_tags(OBJECT_ID, tags)
Beispiel #6
0
 def _row_to_item(self, row):
     return Tag(row["tag"])