示例#1
0
    def __init__(self,
                 name,
                 user,
                 sketch,
                 searchindex,
                 color=None,
                 description=None):
        """Initialize the Timeline object.

        Args:
            name: The name of the timeline
            user: A user (instance of timesketch.models.user.User)
            sketch: A sketch (instance of timesketch.models.sketch.Sketch)
            searchindex: A searchindex
                (instance of timesketch.models.sketch.SearchIndex)
            color: Color for the timeline in HEX as string (e.g. F1F1F1F1)
            description: The description for the timeline
        """
        super(Timeline, self).__init__()
        self.name = name
        self.description = description

        if not color:
            color = random_color()

        self.color = color
        self.user = user
        self.sketch = sketch
        self.searchindex = searchindex
示例#2
0
 def test_random_color(self):
     """Test to generate a random color."""
     color = random_color()
     self.assertTrue(re.match(u'^[0-9a-fA-F]{6}$', color))
示例#3
0
 def test_random_color(self):
     """Test to generate a random color."""
     color = random_color()
     self.assertTrue(re.match(u'^[0-9a-fA-F]{6}$', color))