Example #1
0
def test_crash_id():
    """Tests creating crash ids"""
    crash_id = create_crash_id()

    assert get_date_from_crash_id(crash_id) == '20110906'
    assert get_date_from_crash_id(crash_id, as_datetime=True).strftime('%Y%m%d') == '20110906'

    # Defaults to 1
    assert get_throttle_from_crash_id(crash_id) == 1
Example #2
0
def test_crash_id():
    """Tests creating crash ids"""
    crash_id = create_crash_id()

    assert get_date_from_crash_id(crash_id) == '20110906'
    assert get_date_from_crash_id(
        crash_id, as_datetime=True).strftime('%Y%m%d') == '20110906'

    # Defaults to 1
    assert get_throttle_from_crash_id(crash_id) == 1
Example #3
0
def test_crash_id():
    """Tests creating crash ids"""
    crash_id = create_crash_id()

    assert get_date_from_crash_id(crash_id) == "20110906"
    assert (
        get_date_from_crash_id(crash_id, as_datetime=True).strftime("%Y%m%d")
        == "20110906"
    )

    # Defaults to 1
    assert get_throttle_from_crash_id(crash_id) == 1
Example #4
0
 def _get_dump_name_path(self, crash_id, dump_name):
     """Return path for a given dump."""
     return os.path.join(
         self.root,
         get_date_from_crash_id(crash_id),
         dump_name,
         crash_id
     )
Example #5
0
 def _get_dump_names_path(self, crash_id):
     """Return path for where the dump_names list should go."""
     return os.path.join(
         self.root,
         get_date_from_crash_id(crash_id),
         'dump_names',
         crash_id + '.json'
     )
Example #6
0
 def _get_raw_crash_path(self, crash_id):
     """Return path for where the raw crash should go."""
     return os.path.join(
         self.root,
         get_date_from_crash_id(crash_id),
         'raw_crash',
         crash_id + '.json'
     )
Example #7
0
 def _get_dump_names_path(self, crash_id):
     """Return path for where the dump_names list should go."""
     return os.path.join(
         self.root,
         get_date_from_crash_id(crash_id),
         "dump_names",
         crash_id + ".json",
     )
Example #8
0
 def _get_raw_crash_path(self, crash_id):
     return 'v2/raw_crash/{entropy}/{date}/{crash_id}'.format(
         entropy=crash_id[:3],
         date=get_date_from_crash_id(crash_id),
         crash_id=crash_id
     )
Example #9
0
def test_crash_id_with_date():
    """Tests creating a crash id with a timestamp"""
    crash_id = create_crash_id(datetime(2016, 10, 4))

    assert get_date_from_crash_id(crash_id) == '20161004'
 def _get_raw_crash_path(self, crash_id):
     return 'v2/raw_crash/{entropy}/{date}/{crash_id}'.format(
         entropy=crash_id[:3],
         date=get_date_from_crash_id(crash_id),
         crash_id=crash_id)
Example #11
0
def test_crash_id_with_date():
    """Tests creating a crash id with a timestamp"""
    crash_id = create_crash_id(datetime(2016, 10, 4))

    assert get_date_from_crash_id(crash_id) == '20161004'
Example #12
0
 def _get_dump_name_path(self, crash_id, dump_name):
     """Returns path for a given dump"""
     return os.path.join(self.root, get_date_from_crash_id(crash_id),
                         dump_name, crash_id)
Example #13
0
 def _get_dump_names_path(self, crash_id):
     """Returns path for where the dump_names list should go"""
     return os.path.join(self.root, get_date_from_crash_id(crash_id),
                         'dump_names', crash_id + '.json')
Example #14
0
 def _get_raw_crash_path(self, crash_id):
     """Returns path for where the raw crash should go"""
     return os.path.join(self.root, get_date_from_crash_id(crash_id),
                         'raw_crash', crash_id + '.json')
Example #15
0
 def _get_raw_crash_path(self, crash_id):
     """Return path for where the raw crash should go."""
     return os.path.join(self.root, get_date_from_crash_id(crash_id),
                         "raw_crash", crash_id + ".json")