• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python base.absolute_path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tests.util.base.absolute_path函数的典型用法代码示例。如果您正苦于以下问题:Python absolute_path函数的具体用法?Python absolute_path怎么用?Python absolute_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了absolute_path函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_cancelled_event

def test_cancelled_event(db, default_account):
    with open(absolute_path(FIXTURES + 'google_cancelled1.ics')) as fd:
        ics_data = fd.read()

    msg = add_fake_msg_with_calendar_part(
        db.session, default_account, ics_data)

    import_attached_events(db.session, default_account, msg)
    db.session.commit()

    ev = db.session.query(Event).filter(
        Event.uid == "[email protected]").one()

    assert ev.status == 'confirmed'

    with open(absolute_path(FIXTURES + 'google_cancelled2.ics')) as fd:
        ics_data = fd.read()

    msg2 = add_fake_msg_with_calendar_part(
        db.session, default_account, ics_data)

    import_attached_events(db.session, default_account, msg2)
    db.session.commit()

    ev = db.session.query(Event).filter(
        Event.uid == "[email protected]").one()

    assert ev.status == 'cancelled'
开发者ID:Analect,项目名称:sync-engine,代码行数:28,代码来源:test_ics_parsing.py


示例2: test_icloud_cancelled_event

def test_icloud_cancelled_event(db, default_account):
    with open(absolute_path(FIXTURES + 'icloud_cancelled1.ics')) as fd:
        ics_data = fd.read()

    msg = add_fake_msg_with_calendar_part(
        db.session, default_account, ics_data)

    import_attached_events(db.session, default_account, msg)
    db.session.commit()

    ev = db.session.query(Event).filter(
        Event.uid == "5919D444-7C99-4687-A526-FC5D10091318").one()

    assert ev.status == 'confirmed'

    with open(absolute_path(FIXTURES + 'icloud_cancelled2.ics')) as fd:
        ics_data = fd.read()

    msg = add_fake_msg_with_calendar_part(
        db.session, default_account, ics_data)

    import_attached_events(db.session, default_account, msg)
    db.session.commit()

    ev = db.session.query(Event).filter(
        Event.uid == "5919D444-7C99-4687-A526-FC5D10091318").one()

    assert ev.status == 'cancelled'
开发者ID:Analect,项目名称:sync-engine,代码行数:28,代码来源:test_ics_parsing.py


示例3: test_event_update

def test_event_update(db, default_account, message):
    add_fake_calendar(db.session, default_account.namespace.id,
                      name="Emailed events", read_only=True)

    with open(absolute_path(FIXTURES + 'gcal_v1.ics')) as fd:
        ics_data = fd.read()

    msg = add_fake_msg_with_calendar_part(
        db.session, default_account, ics_data)

    import_attached_events(db.session, default_account, msg)
    db.session.commit()

    ev = db.session.query(Event).filter(
        Event.uid == "[email protected]").one()

    assert ev.location == ("Olympia Hall, 28 Boulevard des Capucines, "
                           "75009 Paris, France")

    with open(absolute_path(FIXTURES + 'gcal_v2.ics')) as fd:
        ics_data = fd.read()

    msg = add_fake_msg_with_calendar_part(
        db.session, default_account, ics_data)

    import_attached_events(db.session, default_account, msg)
    db.session.commit()

    ev = db.session.query(Event).filter(
        Event.uid == "[email protected]").one()

    assert ev.location == (u"Le Zenith, 211 Avenue Jean Jaures, "
                            "75019 Paris, France")
开发者ID:Analect,项目名称:sync-engine,代码行数:33,代码来源:test_ics_parsing.py


示例4: test_self_sent_update

def test_self_sent_update(db, default_account, message):

    # Create the calendars
    add_fake_calendar(db.session, default_account.namespace.id,
                      name="Emailed events", read_only=True)

    default_calendar = add_fake_calendar(db.session,
                                         default_account.namespace.id,
                                         name="Calendar", read_only=False)

    # Import the self-sent event.
    with open(absolute_path(FIXTURES + 'self_sent_v1.ics')) as fd:
        ics_data = fd.read()

    msg = add_fake_msg_with_calendar_part(db.session, default_account,
                                          ics_data)
    msg.from_addr = [(default_account.name, default_account.email_address)]
    import_attached_events(db.session, default_account, msg)
    db.session.commit()

    evs = db.session.query(Event).filter(
        Event.uid == "[email protected]").all()

    assert len(evs) == 1
    ev = evs[0]
    assert ev.location == ("Olympia Hall, 28 Boulevard des Capucines, "
                           "75009 Paris, France")

    # Create a copy of the event, and store it in the default calendar.
    event_copy = Event()
    event_copy.update(ev)
    event_copy.calendar = default_calendar
    db.session.add(event_copy)
    db.session.commit()

    with open(absolute_path(FIXTURES + 'self_sent_v2.ics')) as fd:
        ics_data = fd.read()

    msg = add_fake_msg_with_calendar_part(
        db.session, default_account, ics_data)

    import_attached_events(db.session, default_account, msg)
    db.session.commit()

    evs = db.session.query(Event).filter(
        Event.uid == "[email protected]").all()

    # Check that the event in the default calendar didn't get updated.
    assert len(evs) == 2
    for ev in evs:
        db.session.refresh(ev)
        if ev.calendar_id == default_calendar.id:
            assert ev.location == ("Olympia Hall, 28 Boulevard des Capucines, "
                                   "75009 Paris, France")
        else:
            assert ev.location == (u"Le Zenith, 211 Avenue Jean Jaures, "
                                   "75019 Paris, France")
开发者ID:aabde,项目名称:sync-engine,代码行数:57,代码来源:test_ics_parsing.py


示例5: test_multiple_summaries

def test_multiple_summaries(db, default_account):
    data = None
    with open(absolute_path(FIXTURES + 'multiple_summaries.ics')) as fd:
        data = fd.read()

    events = events_from_ics(default_account.namespace,
                             default_account.emailed_events_calendar, data)

    assert len(events) == 1
    assert events[0].title == 'The Strokes - Is this it?'
开发者ID:Analect,项目名称:sync-engine,代码行数:10,代码来源:test_ics_parsing.py


示例6: test_event_no_participants

def test_event_no_participants(db, default_account):
    data = None
    with open(absolute_path(FIXTURES + 'event_with_no_participants.ics')) as fd:
        data = fd.read()

    events = events_from_ics(default_account.namespace,
                             default_account.emailed_events_calendar, data)
    assert len(events) == 1, "There should be only one event in the test file"
    ev = events[0]
    assert len(ev.participants) == 0
开发者ID:Analect,项目名称:sync-engine,代码行数:10,代码来源:test_ics_parsing.py


示例7: test_handle_missing_sequence_number

def test_handle_missing_sequence_number(db, default_account):
    with open(absolute_path(FIXTURES + 'event_without_sequence.ics')) as fd:
        data = fd.read()

    events = events_from_ics(default_account.namespace,
                             default_account.emailed_events_calendar, data)
    events = events['invites']
    assert len(events) == 1
    ev = events[0]
    assert ev.sequence_number == 0
开发者ID:aabde,项目名称:sync-engine,代码行数:10,代码来源:test_ics_parsing.py


示例8: test_event_no_end_time

def test_event_no_end_time(db, default_account):
    # With no end time, import should fail
    with open(absolute_path(FIXTURES + 'meetup_infinite.ics')) as fd:
        ics_data = fd.read()

    add_fake_msg_with_calendar_part(db.session, default_account, ics_data)

    # doesn't raise an exception (to not derail message parsing, but also
    # doesn't create an event)
    ev = db.session.query(Event).filter(
        Event.uid == "[email protected]").first()
    assert not ev
开发者ID:Analect,项目名称:sync-engine,代码行数:12,代码来源:test_ics_parsing.py


示例9: test_iphone_through_exchange

def test_iphone_through_exchange(db, default_account):
    data = None
    with open(absolute_path(FIXTURES + 'iphone_through_exchange.ics')) as fd:
        data = fd.read()

    events = events_from_ics(default_account.namespace,
                             default_account.emailed_events_calendar, data)
    assert len(events) == 1, "There should be only one event in the test file"

    ev = events[0]
    assert ev.start == arrow.get(2014, 12, 27, 15, 0)
    assert ev.end == arrow.get(2014, 12, 27, 16, 0)
开发者ID:Analect,项目名称:sync-engine,代码行数:12,代码来源:test_ics_parsing.py


示例10: test_multiple_events

def test_multiple_events(db, default_account):
    data = None
    with open(absolute_path(FIXTURES + 'multiple_events.ics')) as fd:
        data = fd.read()

    events = events_from_ics(default_account.namespace,
                             default_account.emailed_events_calendar, data)
    assert len(events) == 2
    ev0 = events[0]
    ev1 = events[1]
    assert len(ev0.participants) == 0
    assert len(ev1.participants) == 0

    assert ev1.start == arrow.get(2015, 03, 17, 0, 0)
开发者ID:Analect,项目名称:sync-engine,代码行数:14,代码来源:test_ics_parsing.py


示例11: test_windows_tz_ical

def test_windows_tz_ical(db, default_account):
    data = None
    with open(absolute_path(FIXTURES + 'windows_event.ics')) as fd:
        data = fd.read()

    events = events_from_ics(default_account.namespace,
                             default_account.emailed_events_calendar, data)
    assert len(events) == 1, "There should be only one event in the test file"

    ev = events[0]
    assert ev.start == arrow.get(2015, 2, 20, 8, 30)
    assert ev.end == arrow.get(2015, 2, 20, 9, 0)
    assert ev.title == "Pommes"
    assert len(ev.participants) == 1
    assert ev.participants[0]['email'] == '[email protected]'
开发者ID:Analect,项目名称:sync-engine,代码行数:15,代码来源:test_ics_parsing.py


示例12: test_icloud_allday_event

def test_icloud_allday_event(db, default_account):
    data = None
    with open(absolute_path(FIXTURES + 'icloud_oneday_event.ics')) as fd:
        data = fd.read()

    events = events_from_ics(default_account.namespace,
                             default_account.emailed_events_calendar, data)
    assert len(events) == 1, "There should be only one event in the test file"

    ev = events[0]
    assert ev.all_day is True
    assert ev.start == arrow.get(2015, 3, 16, 0, 0)
    assert ev.end == arrow.get(2015, 3, 17, 0, 0)

    assert len(ev.participants) == 2
    assert ev.participants[0]['email'] == '[email protected]'
开发者ID:Analect,项目名称:sync-engine,代码行数:16,代码来源:test_ics_parsing.py


示例13: test_recurring_ical

def test_recurring_ical(db, default_account):
    with open(absolute_path(FIXTURES + 'gcal_recur.ics')) as fd:
        ics_data = fd.read()

    msg = add_fake_msg_with_calendar_part(
        db.session, default_account, ics_data)

    import_attached_events(db.session, default_account, msg)
    db.session.commit()

    ev = db.session.query(Event).filter(
        Event.uid == "[email protected]").one()

    assert isinstance(ev, RecurringEvent)
    assert isinstance(ev.recurring, list)
    assert ev.start_timezone == 'America/Los_Angeles'
开发者ID:Analect,项目名称:sync-engine,代码行数:16,代码来源:test_ics_parsing.py


示例14: test_invalid_rsvp

def test_invalid_rsvp(db, default_account):
    # Test that we don't save an RSVP reply with an invalid id.
    data = None
    with open(absolute_path(FIXTURES + 'invalid_rsvp.ics')) as fd:
        data = fd.read()

    msg = add_fake_msg_with_calendar_part(
        db.session, default_account, data)

    import_attached_events(db.session, default_account, msg)
    db.session.commit()

    ev = db.session.query(Event).filter(
        Event.uid == "[email protected]").all()

    assert len(ev) == 0
开发者ID:aabde,项目名称:sync-engine,代码行数:16,代码来源:test_ics_parsing.py


示例15: test_truncate_bogus_sequence_numbers

def test_truncate_bogus_sequence_numbers(db, default_account):
    data = None
    with open(absolute_path(FIXTURES + 'bogus_sequence_number.ics')) as fd:
        data = fd.read()

    msg = add_fake_msg_with_calendar_part(
        db.session, default_account, data)

    import_attached_events(db.session, default_account, msg)
    db.session.commit()

    ev = db.session.query(Event).filter(
        Event.uid == "[email protected]").one()

    # Check that the sequence number got truncated to the biggest possible
    # number.
    assert ev.sequence_number == 2147483647L
开发者ID:aabde,项目名称:sync-engine,代码行数:17,代码来源:test_ics_parsing.py


示例16: test_rsvp_for_other_provider

def test_rsvp_for_other_provider(db, default_account):
    # Test that we don't save RSVP replies which aren't replies to a Nylas
    # invite.
    data = None
    with open(absolute_path(FIXTURES + 'invalid_rsvp2.ics')) as fd:
        data = fd.read()

    msg = add_fake_msg_with_calendar_part(
        db.session, default_account, data)

    import_attached_events(db.session, default_account, msg)
    db.session.commit()

    ev = db.session.query(Event).filter(
        Event.uid == "[email protected]").all()

    assert len(ev) == 0
开发者ID:aabde,项目名称:sync-engine,代码行数:17,代码来源:test_ics_parsing.py


示例17: test_invalid_sender

def test_invalid_sender(from_value, db, default_account):
    # Check that messages with an invalid from field get discarded.
    data = None
    event_count = db.session.query(Event).count()

    with open(absolute_path(FIXTURES + 'iphone_through_exchange.ics')) as fd:
        data = fd.read()

    msg = add_fake_msg_with_calendar_part(db.session, default_account,
                                          data)
    msg.from_addr = from_value
    db.session.add(msg)
    db.session.commit()

    import_attached_events(db.session, default_account, msg)
    db.session.commit()

    event_count2 = db.session.query(Event).count()
    assert event_count == event_count2, "The event shouldn't have been added"
开发者ID:yodiyo,项目名称:sync-engine,代码行数:19,代码来源:test_ics_parsing.py


示例18: test_icalendar_import

def test_icalendar_import(db, generic_account, message):
    add_fake_calendar(db.session, generic_account.namespace.id,
                      name="Emailed events", read_only=True)

    with open(absolute_path(FIXTURES + 'invite_w_rsvps1.ics')) as fd:
        ics_data = fd.read()

    msg = add_fake_msg_with_calendar_part(
        db.session, generic_account, ics_data)

    import_attached_events(db.session, generic_account, msg)

    ev = db.session.query(Event).filter(
        Event.uid == ("040000008200E00074C5B7101A82E00800000000"
                      "F9125A30B06BD001000000000000000010000000"
                      "9D791C7548BFD144BFA54F14213CAD25")).one()

    assert len(ev.participants) == 2
    for participant in ev.participants:
        assert participant['status'] == 'noreply'
开发者ID:aabde,项目名称:sync-engine,代码行数:20,代码来源:test_ics_parsing.py


示例19: pytest_generate_tests

def pytest_generate_tests(metafunc):
    if 'db' in metafunc.fixturenames:
        dumpfile = absolute_path(config()['BASE_DUMP'])
        savedb = False

        metafunc.parametrize('db', [(dumpfile, savedb)], indirect=True)
开发者ID:Analect,项目名称:sync-engine,代码行数:6,代码来源:conftest.py


示例20: latest_db

def latest_db(config):
    dumpfile = absolute_path('data/base_dump.sql')
    testdb = TestDB(config, dumpfile)
    yield testdb
    testdb.teardown()
开发者ID:PriviPK,项目名称:privipk-sync-engine,代码行数:5,代码来源:test_namespace.py



注:本文中的tests.util.base.absolute_path函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python base.add_fake_imapuid函数代码示例发布时间:2022-05-27
下一篇:
Python asserts.equals函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap