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() )
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() )
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()))
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()))
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, )
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)
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]
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()
def get_entry(self, item): item["suggestion_comment"] = self.comment_dict.get( item["suggestion_id"]) return self.entry_class(SubmissionProxy(item)).entry