Beispiel #1
0
    def test_can_parse_report_end_time(self):
        raw_report = _get_test_file("failed_false.txt")

        actual = RoboCopyReport(raw_report, "").get_end_time()
        expected = dt(2019, 3, 8, 0, 5, 1)

        assert actual.ctime() == expected.ctime()
Beispiel #2
0
 def test_handle_invalid_files(self):
     raw_report = _get_test_file("invalid_file.txt")
     try:
         RoboCopyReport(raw_report, "")
         assert True
     except Exception as e:
         pytest.fail(str(e))
Beispiel #3
0
    def test_can_get_file_name(self):
        raw_report = _get_test_file("failed_false.txt")
        name = "thisismyname"
        actual = RoboCopyReport(raw_report, name).get_name()
        expected = name

        assert actual == expected
Beispiel #4
0
    def test_can_get_failed_files(self):
        raw_report = _get_test_file("failed_true.txt")

        actual = RoboCopyReport(raw_report, "").get_failed_files()
        expected = 5

        assert actual == expected
def get_reports(report_path, report_date):
    reports = []
    for file_name in os.listdir(report_path):
        file_path = os.path.join(report_path, file_name)
        file_created = dt.fromtimestamp(os.path.getmtime(file_path))

        if re.match(FILES_MATCHING,
                    file_name) and file_created.date() == report_date.date():
            file_body = open(file_path, 'r').read()
            reports.append(RoboCopyReport(file_body, file_name))

    return reports
Beispiel #6
0
    def test_can_get_failed_false(self):
        raw_report = _get_test_file("failed_false.txt")

        actual = RoboCopyReport(raw_report, "")

        assert actual.has_failed() == False