How to use the timesketch.apps.sketch.models.Sketch.objects.create function in timesketch

To help you get started, we’ve selected a few timesketch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github google / timesketch / timesketch / apps / sketch / tests.py View on Github external
def setUp(self):
        self.user = User.objects.create(username="testuser")
        self.sketch = Sketch.objects.create(
            user=self.user, title="testsketch1")
        self.timeline = Timeline.objects.create(
            user=self.user, title="test", datastore_index="123456")
        self.sketch_timeline = SketchTimeline.objects.create(
            timeline=self.timeline, user=self.user, sketch=self.sketch)
github google / timesketch / timesketch / apps / sketch / tests.py View on Github external
def setUp(self):
        self.user1 = User.objects.create(username="testuser1")
        self.user2 = User.objects.create(username="testuser2")
        self.sketch1 = Sketch.objects.create(
            user=self.user1, title="testsketch1")
        self.sketch2 = Sketch.objects.create(
            user=self.user1, title="testsketch2")
        SavedView.objects.create(
            user=self.user1, sketch=self.sketch2, query="", filter="")
        self.sketch1.make_public(self.user1)
        self.sketch2.make_private(self.user1)
github google / timesketch / timesketch / apps / acl / tests.py View on Github external
def setUp(self):
        self.user = User.objects.create(username='user1')
        self.sketch1 = Sketch.objects.create(user=self.user, title='sketch1')
        self.sketch2 = Sketch.objects.create(user=self.user, title='sketch2')
        self.sketch1.make_public(self.user)
        self.sketch2.make_private(self.user)
        self.ace = self.sketch1.acl.create(user=self.user)
        # Make the sketch public again to catch the case where an public ace is
        # already present.
        self.sketch1.make_public(self.user)
github google / timesketch / timesketch / apps / api / tests.py View on Github external
def _create_sketch(self, user):
        """Creates a sketch, comment and saved view to be used in the tests.

        Returns:
            Sketch object (instance of timesketch.apps.sketch.models.Sketch)
        """
        sketch = Sketch.objects.create(user=user, title='Test')
        EventComment.objects.create(
            user=user, body='test', sketch=sketch, datastore_id='test',
            datastore_index='test')
        SavedView.objects.create(
            user=user, sketch=sketch, query="Test",
            filter=json.dumps({'foo': 'bar'}), name="Test")
        return sketch
github google / timesketch / timesketch / apps / acl / tests.py View on Github external
def setUp(self):
        self.user = User.objects.create(username='user1')
        self.sketch1 = Sketch.objects.create(user=self.user, title='sketch1')
        self.sketch2 = Sketch.objects.create(user=self.user, title='sketch2')
        self.sketch1.make_public(self.user)
        self.sketch2.make_private(self.user)
        self.ace = self.sketch1.acl.create(user=self.user)
        # Make the sketch public again to catch the case where an public ace is
        # already present.
        self.sketch1.make_public(self.user)
github google / timesketch / timesketch / apps / api / v1_resources.py View on Github external
def obj_create(self, bundle, **kwargs):
        req_data = json.loads(bundle.request.body)['data'] 
        Sketch.objects.create(user=bundle.request.user,
            title=req_data['title'], description=req_data['description'])
        return bundle