def test_01_subscriptions(self):
        r = save_subscription(SUBSCRIPTION1)
        self.assertTrue(r)

        # Update
        r = save_subscription(SUBSCRIPTION2)

        # Get
        subs = get_subscription()
        self.assertEqual(len(subs), 1)
        subs = get_subscription("demo_application")
        self.assertEqual(len(subs), 1)
        otrs_sub = subs[0]
        self.assertEqual(otrs_sub.get("application"), "demo_application")
        self.assertEqual(otrs_sub.get("for_name"), "customer")
        self.assertEqual(otrs_sub.get("for_email"), "*****@*****.**")
        self.assertEqual(otrs_sub.get("num_tokens"), 200)

        # delete
        s = delete_subscription("demo_application")
        self.assertTrue(s)

        # get
        subs = get_subscription("demo_application")
        self.assertEqual(len(subs), 0)
Beispiel #2
0
def api_delete(application=None):
    """
    Create a subscription request.
    This request needs to be sent to NetKnights to create a subscription
    """
    r = delete_subscription(application)
    return send_result(r)
def api_delete(application=None):
    """
    Delete an existing subscription
    """
    r = delete_subscription(application)
    g.audit_object.log({'success': True})
    return send_result(r)
    def test_01_subscriptions(self):
        r = save_subscription(SUBSCRIPTION1)
        self.assertTrue(r)

        # Update
        r = save_subscription(SUBSCRIPTION2)

        # Get
        subs = get_subscription()
        self.assertEqual(len(subs), 1)
        subs = get_subscription("demo_application")
        self.assertEqual(len(subs), 1)
        otrs_sub = subs[0]
        self.assertEqual(otrs_sub.get("application"), "demo_application")
        self.assertEqual(otrs_sub.get("for_name"), "customer")
        self.assertEqual(otrs_sub.get("for_email"), "*****@*****.**")
        self.assertEqual(otrs_sub.get("num_tokens"), 200)

        # delete
        s = delete_subscription("demo_application")
        self.assertTrue(s)

        # get
        subs = get_subscription("demo_application")
        self.assertEqual(len(subs), 0)
def api_delete(application=None):
    """
    Create a subscription request.
    This request needs to be sent to NetKnights to create a subscription
    """
    r = delete_subscription(application)
    g.audit_object.log({'success': True})
    return send_result(r)
Beispiel #6
0
def api_delete(application=None):
    """
    Create a subscription request.
    This request needs to be sent to NetKnights to create a subscription
    """
    r = delete_subscription(application)
    g.audit_object.log({'success': True})
    return send_result(r)