File: specification.py

package info (click to toggle)
plaso 20190131-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 410,832 kB
  • sloc: python: 76,636; sh: 926; makefile: 167; xml: 70; sql: 14; vhdl: 11
file content (33 lines) | stat: -rw-r--r-- 890 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the format specification classes."""

from __future__ import unicode_literals

import unittest

from plaso.lib import specification


class FormatSpecificationStoreTest(unittest.TestCase):
  """Class to test the specification store."""

  def testAddSpecification(self):
    """Function to test the AddSpecification function."""
    store = specification.FormatSpecificationStore()

    format_regf = specification.FormatSpecification('REGF')
    format_regf.AddNewSignature(b'regf', offset=0)

    format_esedb = specification.FormatSpecification('ESEDB')
    format_esedb.AddNewSignature(b'\xef\xcd\xab\x89', offset=4)

    store.AddSpecification(format_regf)
    store.AddSpecification(format_esedb)

    with self.assertRaises(KeyError):
      store.AddSpecification(format_regf)


if __name__ == '__main__':
  unittest.main()