Пример #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
Пример #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
Пример #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
Пример #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
     )
Пример #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'
     )
Пример #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'
     )
Пример #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",
     )
Пример #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
     )
Пример #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)
Пример #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'
Пример #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)
Пример #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')
Пример #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')
Пример #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")