Exemple #1
0
    def test_with_wrong_event_time(self):
        volume_snapshot_event = utils.get_volume_snapshot_event()
        volume_snapshot_event['event_time'] = '2015-10-21T01:00:00.000000'
        self.post_json('/events', volume_snapshot_event)

        volume_snapshot_event = utils.get_volume_snapshot_event()
        volume_snapshot_event['event_time'] = '2015-09-21T01:00:00.000000'
        volume_snapshot_event['event_type'] = 'exists'
        self.post_json('/events', volume_snapshot_event, expect_errors=True)
    def test_with_wrong_event_time(self):
        volume_snapshot_event = utils.get_volume_snapshot_event()
        volume_snapshot_event['event_time'] = '2015-10-21T01:00:00.000000'
        self.post_json('/events', volume_snapshot_event)

        volume_snapshot_event = utils.get_volume_snapshot_event()
        volume_snapshot_event['event_time'] = '2015-09-21T01:00:00.000000'
        volume_snapshot_event['event_type'] = 'exists'
        self.post_json('/events', volume_snapshot_event, expect_errors=True)
Exemple #3
0
    def test_create_delete_exists_event_success(self):
        volume_snapshot_event = utils.get_volume_snapshot_event()
        volume_snapshot_event['event_time'] = '2015-10-01T01:00:00.000000'
        self.post_json('/events', volume_snapshot_event)

        volume_snapshot_event['event_time'] = '2015-10-11T01:00:00.000000'
        volume_snapshot_event['event_type'] = 'delete'
        self.post_json('/events', volume_snapshot_event)

        url = '/resources/' + volume_snapshot_event['resource_id']
        res = self.get_json(url)
        self.assertEqual(res['status'], 'delete')
        self.assertEqual(int(res['consumption']), 2400)

        volume_snapshot_event['event_time'] = '2015-10-21T01:00:00.000000'
        volume_snapshot_event['event_type'] = 'exists'
        self.post_json('/events', volume_snapshot_event, expect_errors=True)

        url = '/resources/' + volume_snapshot_event['resource_id']
        res = self.get_json(url)
        self.assertEqual(res['status'], 'delete')
        self.assertEqual(int(res['consumption']), 2400)

        url = '/records/' + volume_snapshot_event['resource_id']
        records = self.get_json(url)
        self.assertEqual(len(records), 1)
    def test_create_delete_exists_event_success(self):
        volume_snapshot_event = utils.get_volume_snapshot_event()
        volume_snapshot_event['event_time'] = '2015-10-01T01:00:00.000000'
        self.post_json('/events', volume_snapshot_event)

        volume_snapshot_event['event_time'] = '2015-10-11T01:00:00.000000'
        volume_snapshot_event['event_type'] = 'delete'
        self.post_json('/events', volume_snapshot_event)

        url = '/resources/' + volume_snapshot_event['resource_id']
        res = self.get_json(url)
        self.assertEqual(res['status'], 'delete')
        self.assertEqual(int(res['consumption']), 2400)

        volume_snapshot_event['event_time'] = '2015-10-21T01:00:00.000000'
        volume_snapshot_event['event_type'] = 'exists'
        self.post_json('/events', volume_snapshot_event, expect_errors=True)

        url = '/resources/' + volume_snapshot_event['resource_id']
        res = self.get_json(url)
        self.assertEqual(res['status'], 'delete')
        self.assertEqual(int(res['consumption']), 2400)

        url = '/records/' + volume_snapshot_event['resource_id']
        records = self.get_json(url)
        self.assertEqual(len(records), 1)
Exemple #5
0
    def test_post_delete_event_success(self):
        volume_snapshot_event = utils.get_volume_snapshot_event()
        volume_snapshot_event['event_type'] = 'delete'
        self.post_json('/events', volume_snapshot_event)

        url = '/resources/' + volume_snapshot_event['resource_id']
        self.get_json(url, expect_errors=True)

        url = '/records/' + volume_snapshot_event['resource_id']
        self.get_json(url, expect_errors=True)
Exemple #6
0
    def test_post_create_event_success(self):
        volume_snapshot_event = utils.get_volume_snapshot_event()
        self.post_json('/events', volume_snapshot_event)

        url = '/resources/' + volume_snapshot_event['resource_id']
        res = self.get_json(url)
        self.assertEqual(res['status'], 'active')

        url = '/records/' + volume_snapshot_event['resource_id']
        self.get_json(url, expect_errors=True)
    def test_post_delete_event_success(self):
        volume_snapshot_event = utils.get_volume_snapshot_event()
        volume_snapshot_event['event_type'] = 'delete'
        self.post_json('/events', volume_snapshot_event)

        url = '/resources/' + volume_snapshot_event['resource_id']
        self.get_json(url, expect_errors=True)

        url = '/records/' + volume_snapshot_event['resource_id']
        self.get_json(url, expect_errors=True)
    def test_post_create_event_success(self):
        volume_snapshot_event = utils.get_volume_snapshot_event()
        self.post_json('/events', volume_snapshot_event)

        url = '/resources/' + volume_snapshot_event['resource_id']
        res = self.get_json(url)
        self.assertEqual(res['status'], 'active')

        url = '/records/' + volume_snapshot_event['resource_id']
        self.get_json(url, expect_errors=True)
Exemple #9
0
 def test_with_wrong_event_type(self):
     volume_snapshot_event = utils.get_volume_snapshot_event()
     volume_snapshot_event['event_type'] = 'resize'
     self.post_json('/events', volume_snapshot_event, expect_errors=True)
Exemple #10
0
 def test_with_wrong_size_in_content(self):
     volume_snapshot_event = utils.get_volume_snapshot_event()
     volume_snapshot_event['content']['size'] = 'wrong_size'
     self.post_json('/events', volume_snapshot_event, expect_errors=True)
Exemple #11
0
 def test_without_content(self):
     volume_snapshot_event = utils.get_volume_snapshot_event()
     volume_snapshot_event.pop('content')
     self.post_json('/events', volume_snapshot_event, expect_errors=True)
Exemple #12
0
 def test_without_resource_id(self):
     volume_snapshot_event = utils.get_volume_snapshot_event()
     volume_snapshot_event.pop('resource_id')
     self.post_json('/events', volume_snapshot_event, expect_errors=True)
 def test_with_wrong_event_type(self):
     volume_snapshot_event = utils.get_volume_snapshot_event()
     volume_snapshot_event['event_type'] = 'resize'
     self.post_json('/events', volume_snapshot_event, expect_errors=True)
 def test_with_wrong_size_in_content(self):
     volume_snapshot_event = utils.get_volume_snapshot_event()
     volume_snapshot_event['content']['size'] = 'wrong_size'
     self.post_json('/events', volume_snapshot_event, expect_errors=True)
 def test_without_content(self):
     volume_snapshot_event = utils.get_volume_snapshot_event()
     volume_snapshot_event.pop('content')
     self.post_json('/events', volume_snapshot_event, expect_errors=True)
 def test_without_resource_id(self):
     volume_snapshot_event = utils.get_volume_snapshot_event()
     volume_snapshot_event.pop('resource_id')
     self.post_json('/events', volume_snapshot_event, expect_errors=True)