示例#1
0
文件: proxy.py 项目: sshyran/zing
def test_submission_proxy_qc_info(quality_check_submission):
    subs = Submission.objects.filter(pk=quality_check_submission.pk)
    proxy = SubmissionProxy(subs.values(*SubmissionProxy.info_fields).first())
    _test_submission_proxy(proxy, quality_check_submission, SubmissionProxy.info_fields)
    assert sorted(proxy.get_submission_info().items()) == sorted(
        quality_check_submission.get_submission_info().items()
    )
示例#2
0
文件: proxy.py 项目: sshyran/zing
def test_submission_proxy_info(submissions):
    values = Submission.objects.values(*(("id",) + SubmissionProxy.info_fields))
    for v in values.iterator():
        proxy = SubmissionProxy(v)
        submission = submissions[v["id"]]
        _test_submission_proxy(proxy, submission, SubmissionProxy.info_fields)
        assert sorted(proxy.get_submission_info().items()) == sorted(
            submission.get_submission_info().items()
        )
示例#3
0
def test_submission_proxy_qc_info(quality_check_submission):
    subs = Submission.objects.filter(pk=quality_check_submission.pk)
    proxy = SubmissionProxy(subs.values(*SubmissionProxy.info_fields).first())
    _test_submission_proxy(
        proxy,
        quality_check_submission,
        SubmissionProxy.info_fields)
    assert (
        sorted(proxy.get_submission_info().items())
        == sorted(quality_check_submission.get_submission_info().items()))
示例#4
0
def test_submission_proxy_info(submissions):
    values = Submission.objects.values(
        *(("id", ) + SubmissionProxy.info_fields))
    for v in values.iterator():
        proxy = SubmissionProxy(v)
        submission = submissions[v["id"]]
        _test_submission_proxy(
            proxy,
            submission,
            SubmissionProxy.info_fields)
        assert (
            sorted(proxy.get_submission_info().items())
            == sorted(submission.get_submission_info().items()))
示例#5
0
文件: proxy.py 项目: sshyran/zing
def test_submission_proxy_qc_timeline(quality_check_submission):
    subs = Submission.objects.filter(pk=quality_check_submission.pk)
    _test_submission_proxy(
        SubmissionProxy(subs.values(*SubmissionProxy.timeline_fields).first()),
        quality_check_submission,
        SubmissionProxy.timeline_fields,
    )
示例#6
0
文件: proxy.py 项目: yiyibooks/pootle
def test_submission_proxy_timeline(submissions):
    values = Submission.objects.values(
        *(("id", ) + SubmissionProxy.timeline_fields))
    for v in values.iterator():
        _test_submission_proxy(
            SubmissionProxy(v),
            submissions[v["id"]],
            SubmissionProxy.timeline_fields)
示例#7
0
def test_submission_proxy_timeline_info(quality_check_submission):
    """If you use the timeline fields but call get_submission_info you will
    get the sub info without the unit data
    """
    subs = Submission.objects.filter(pk=quality_check_submission.pk)
    sub = subs.values(*SubmissionProxy.timeline_fields).first()
    proxy = SubmissionProxy(sub)
    assert proxy.unit_info == {}
    assert proxy.unit_translate_url is None
    assert proxy.unit_pootle_path is None
    assert proxy.unit_state is None
    non_unit_fields = [
        'username', 'display_datetime', 'displayname',
        'mtime', 'type', 'email', 'profile_url']
    proxy_info = proxy.get_submission_info()
    sub_info = quality_check_submission.get_submission_info()
    for k in non_unit_fields:
        assert proxy_info[k] == sub_info[k]
示例#8
0
文件: proxy.py 项目: yiyibooks/pootle
def test_submission_proxy_timeline_info(quality_check_submission):
    """If you use the timeline fields but call get_submission_info you will
    get the sub info without the unit data
    """
    subs = Submission.objects.filter(pk=quality_check_submission.pk)
    sub = subs.values(*SubmissionProxy.timeline_fields).first()
    proxy = SubmissionProxy(sub)
    assert proxy.unit_info == {}
    assert proxy.unit_translate_url is None
    assert proxy.unit_pootle_path is None
    assert proxy.unit_state is None
    non_unit_fields = [
        'username', 'display_datetime', 'displayname',
        'mtime', 'type', 'email', 'profile_url']
    proxy_info = proxy.get_submission_info()
    sub_info = quality_check_submission.get_submission_info()
    for k in non_unit_fields:
        assert proxy_info[k] == sub_info[k]
示例#9
0
文件: utils.py 项目: lawlor/pootle
 def get_info_for_sub(self, sub):
     """Uses a SubmissionProxy to turn the member of a qs.values
     into submission_info
     """
     return SubmissionProxy(sub).get_submission_info()
示例#10
0
 def get_entry(self, item):
     item["suggestion_comment"] = self.comment_dict.get(
         item["suggestion_id"])
     return self.entry_class(SubmissionProxy(item)).entry