def ut_bad_single_log_saved_time():

    single_log_path = PATH_TO_LOGS + "bad_single_log"

    # Read in timestamp so we can save it for later use.
    timestamp_file = open(single_log_path + ".timestamp", "r")
    timestamp_contents = timestamp_file.read()
    timestamp_file.close()

    log_dict = analyzer.analyze_log(single_log_path, True)

    # Since we are using the saved time option we must restore the original
    # timestamp since it was overwritten during runtime.
    timestamp_file = open(single_log_path + ".timestamp", "w")
    timestamp_file.write(timestamp_contents)
    timestamp_file.close()

    # Open and load the answer for this unit test.
    answer_path = PATH_TO_LOGS + "bad_single_log_answer_saved_time.pik"
    answer = _open_answer(answer_path)

    # Store answer for later
    #  fd = open(answer_path,'w')
    #  pickle.dump(log_dict, fd)
    #  fd.close()

    if log_dict != answer:
        print "The test for a single log, using the most recently stored",
        print "timestamp has failed!",
def ut_bad_single_log_saved_time():

    single_log_path = PATH_TO_LOGS + 'bad_single_log'

    # Read in timestamp so we can save it for later use.
    timestamp_file = open(single_log_path + '.timestamp', 'r')
    timestamp_contents = timestamp_file.read()
    timestamp_file.close()

    log_dict = analyzer.analyze_log(single_log_path, True)

    # Since we are using the saved time option we must restore the original
    # timestamp since it was overwritten during runtime.
    timestamp_file = open(single_log_path + '.timestamp', 'w')
    timestamp_file.write(timestamp_contents)
    timestamp_file.close()

    # Open and load the answer for this unit test.
    answer_path = PATH_TO_LOGS + 'bad_single_log_answer_saved_time.pik'
    answer = _open_answer(answer_path)

    # Store answer for later
    #  fd = open(answer_path,'w')
    #  pickle.dump(log_dict, fd)
    #  fd.close()

    if log_dict != answer:
        print "The test for a single log, using the most recently stored",
        print "timestamp has failed!",
Example #3
0
def ut_correct_single_log_all_time():

  single_log_path = PATH_TO_LOGS + 'correct_single_log'
  log_dict = analyzer.analyze_log(single_log_path)

  # Open and load the answer for this unit test.
  answer = _open_answer(PATH_TO_LOGS + 'correct_single_log_answer.pik')
   
  if log_dict != answer:
    print "The test for a single log, checking all timestamps failed!"
def ut_bad_single_log_all_time():

    single_log_path = PATH_TO_LOGS + "bad_single_log"
    log_dict = analyzer.analyze_log(single_log_path)

    # Open and load the answer for this unit test.
    answer = _open_answer(PATH_TO_LOGS + "bad_single_log_answer.pik")

    if log_dict != answer:
        print "The test for a single log, checking all timestamps failed!"
Example #5
0
def ut_correct_single_log_custom_time():

  single_log_path = PATH_TO_LOGS + 'correct_single_log'
  timestamp = 1283097094.98
  log_dict = analyzer.analyze_log(single_log_path, False, timestamp)

  # Open and load the answer for this unit test.
  answer_path = PATH_TO_LOGS + 'correct_single_log_answer_custom_time.pik'
  answer = _open_answer(answer_path)

  if log_dict != answer:
    print "The test for a single log, checking timestamps after:", timestamp,
    print "failed!"
def ut_bad_single_log_custom_time():

    single_log_path = PATH_TO_LOGS + "bad_single_log"
    timestamp = 1280356131.39
    log_dict = analyzer.analyze_log(single_log_path, False, timestamp)

    # Open and load the answer for this unit test.
    answer_path = PATH_TO_LOGS + "bad_single_log_answer_custom_time.pik"
    answer = _open_answer(answer_path)

    if log_dict != answer:
        print "The test for a single log, checking timestamps after:", timestamp,
        print "failed!"