Beispiel #1
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()))
Beispiel #2
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()))
Beispiel #3
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]