예제 #1
0
 def test_delete_sub_when_state_locking(self):
     subscription_locking_data = create_subscription_data('MG_locking')
     subscription_locking_data.measurement_groups[
         0].measurement_group_name = 'locking'
     subscription_locking_data.measurement_groups[
         0].administrative_state = 'LOCKING'
     db.session.add(subscription_locking_data)
     db.session.add(subscription_locking_data.measurement_groups[0])
     db.session.commit()
     db.session.remove()
     message, status_code = delete_subscription_by_name('MG_locking')
     self.assertEqual(status_code, HTTPStatus.CONFLICT.value)
     self.assertEqual(
         subscription_service.query_subscription_by_name(
             'MG_locking').subscription_name, 'MG_locking')
예제 #2
0
 def test_delete_sub_when_state_locked(self):
     subscription_unlocked_data = create_subscription_data('MG_locked')
     subscription_unlocked_data.measurement_groups[
         0].measurement_group_name = 'lock'
     subscription_unlocked_data.measurement_groups[
         0].administrative_state = 'LOCKED'
     db.session.add(subscription_unlocked_data)
     db.session.add(subscription_unlocked_data.measurement_groups[0])
     db.session.commit()
     db.session.remove()
     none_type, status_code = delete_subscription_by_name('MG_locked')
     self.assertEqual(none_type, None)
     self.assertEqual(status_code, HTTPStatus.NO_CONTENT.value)
     self.assertEqual(
         subscription_service.query_subscription_by_name('MG_locked'), None)
예제 #3
0
 def test_delete_sub_exception(self):
     error, status_code = delete_subscription_by_name('None')
     self.assertEqual(status_code, HTTPStatus.INTERNAL_SERVER_ERROR.value)
예제 #4
0
 def test_delete_sub_none(self):
     message, status_code = delete_subscription_by_name('None')
     self.assertEqual(message['error'],
                      'Subscription is not defined with name None')
     self.assertEqual(status_code, HTTPStatus.NOT_FOUND.value)