Exemplo n.º 1
0
    def test_to_table(self):

        site = USite.objects.create(name="site")
        unit = utils.create_unit(site=site)
        utc = utils.create_unit_test_collection(unit=unit)
        utils.create_test_list_instance(unit_test_collection=utc)

        unit2 = utils.create_unit(site=None)
        utc2 = utils.create_unit_test_collection(unit=unit2)
        utils.create_test_list_instance(unit_test_collection=utc2)

        rep = qc.NextDueDatesReport()
        rep.report_format = "csv"
        context = rep.get_context()
        table = rep.to_table(context)

        header_count = table.count([
            _("Unit"),
            _("Name"),
            _("Frequency"),
            _("Due Date"),
            _("Window"),
            _("Assigned To"),
            _("Perform")
        ])
        assert header_count == 2
Exemplo n.º 2
0
    def test_generate_next_due_dates_html(self):
        site = USite.objects.create(name="site")
        unit = utils.create_unit(site=site)
        utc = utils.create_unit_test_collection(unit=unit)
        tli = utils.create_test_list_instance(unit_test_collection=utc)
        utils.create_test_instance(test_list_instance=tli)

        rep = qc.NextDueDatesReport()
        rep.report_format = "pdf"
        rep.to_html()
Exemplo n.º 3
0
 def test_get_unit_details(self):
     site = USite.objects.create(name="site")
     unit = utils.create_unit(site=site)
     units = qc.NextDueDatesReport().get_unit_details([unit.pk])
     assert units == ('Unit(s)', '%s - %s' % (unit.site.name, unit.name))
Exemplo n.º 4
0
 def test_get_unit__site_details(self):
     site = USite.objects.create(name="site")
     sites = qc.NextDueDatesReport().get_unit__site_details([site, 'null'])
     assert sites == ('Site(s)', 'site, Other')
Exemplo n.º 5
0
 def test_next_due_dates_get_filename(self):
     assert qc.NextDueDatesReport().get_filename(
         'pdf') == 'next-due-dates-for-qc.pdf'
Exemplo n.º 6
0
 def test_get_queryset(self):
     assert qc.NextDueDatesReport().get_queryset(
     ).model._meta.model_name == "unittestcollection"