Esempio n. 1
0
    class FakeTrigger(gate.BaseTrigger):
        __trigger_name__ = 'TestingTrigger'
        __description__ = 'Not real'
        __trigger_id__ = 'Blah123'
        param1 = params.TriggerParameter(name='param_test', description='Test parameter', validator=TypeValidator("string"), is_required=False)

        def test1(self):
            print(type(self.param1))
class FakeTrigger(gate.BaseTrigger):
    __trigger_name__ = "TestingTrigger"
    __description__ = "Not real"
    __trigger_id__ = "Blah123"

    param1 = params.TriggerParameter(
        name="param_test",
        example_str="somevalue",
        description="Test parameter",
        validator=TypeValidator("string"),
        is_required=False,
    )

    def test1(self):
        print((type(self.param1)))
Esempio n. 3
0
    def test_param_basics(self):
        p = params.TriggerParameter('TestParam1', description='Param for testing basic strings', validator=TypeValidator("string"), related_to='ThisOtherParam')

        print('Trying string that should pass validation')

        # Should pass validation
        print(p.set_value('somestring'))
        print('Got value: {}'.format(p.value()))

        print('Trying an int that should fail validation')

        # Should fail validation
        with self.assertRaises(ValidationError) as ex:
            print(p.set_value(10))

        print('Correctly got exception {}'.format(ex.exception))
    def test_param_basics(self):
        p = params.TriggerParameter(
            "TestParam1",
            description="Param for testing basic strings",
            validator=TypeValidator("string"),
            related_to="ThisOtherParam",
        )

        print("Trying string that should pass validation")

        # Should pass validation
        print((p.set_value("somestring")))
        print(("Got value: {}".format(p.value())))

        print("Trying an int that should fail validation")

        # Should fail validation
        with self.assertRaises(ValidationError) as ex:
            print((p.set_value(10)))

        print(("Correctly got exception {}".format(ex.exception)))