Esempio n. 1
0
    def test_valid_template_with_time(self):
        keyboard_template = """[['Back'],['{% now 'local' %}']]"""
        validate_telegram_keyboard(keyboard_template)
    
#     #TODO: this case is not covered. When rendering the bad pattern is not validated
#     def test_not_valid_with_template_outside_not_generated(self):
#         keyboard_template = "{% if response.status == 400 %}[['a','b']{% else %}[['b', 'c']]{% endif %}"
#         self.assertRaises(ValidationError, validate_telegram_keyboard, keyboard_template)    
Esempio n. 2
0
    def test_valid_template_with_time(self):
        keyboard_template = """[['Back'],['{% now 'local' %}']]"""
        validate_telegram_keyboard(keyboard_template)


#     #TODO: this case is not covered. When rendering the bad pattern is not validated
#     def test_not_valid_with_template_outside_not_generated(self):
#         keyboard_template = "{% if response.status == 400 %}[['a','b']{% else %}[['b', 'c']]{% endif %}"
#         self.assertRaises(ValidationError, validate_telegram_keyboard, keyboard_template)
Esempio n. 3
0
 def test_valid_no_template(self):
     keyboard_template = "[['a','b']]"
     validate_telegram_keyboard(keyboard_template)
Esempio n. 4
0
 def test_valid_template_with_state_context(self):
     keyboard_template = """[['Back']{% for repo in state_context.user_detail.response.data %}{% if loop.first %},{% endif %}
                         ['{{repo.full_name}}']{% if not loop.last %},{% endif %}{% endfor%}]"""
     validate_telegram_keyboard(keyboard_template)
Esempio n. 5
0
 def test_valid_with_template_outside_rendered_as_none(self):
     keyboard_template = "{% if response.status == 200 %}[['Repos', 'Starred'],['Back']]{% endif %}"
     validate_telegram_keyboard(keyboard_template)
Esempio n. 6
0
 def test_valid_with_template_outside(self):
     keyboard_template = "{% if response.status == 400 %}[['a','b']]{% else %}[['b', 'c']]{% endif %}"
     validate_telegram_keyboard(keyboard_template)
Esempio n. 7
0
 def test_valid_with_template_inside(self):
     keyboard_template = "[['{{response.value}}','{% if pattern.condition %}{{ pattern.condition }}{% else %}back{% endif %}']]"
     validate_telegram_keyboard(keyboard_template)
Esempio n. 8
0
 def test_valid_no_template(self):
     keyboard_template = "[['a','b']]"
     validate_telegram_keyboard(keyboard_template)
Esempio n. 9
0
 def test_valid_template_with_state_context(self):
     keyboard_template = """[['Back']{% for repo in state_context.user_detail.response.data %}{% if loop.first %},{% endif %}
                         ['{{repo.full_name}}']{% if not loop.last %},{% endif %}{% endfor%}]"""
     validate_telegram_keyboard(keyboard_template)
Esempio n. 10
0
 def test_valid_with_template_outside_rendered_as_none(self):
     keyboard_template = "{% if response.status == 200 %}[['Repos', 'Starred'],['Back']]{% endif %}"
     validate_telegram_keyboard(keyboard_template)
Esempio n. 11
0
 def test_valid_with_template_outside(self):
     keyboard_template = "{% if response.status == 400 %}[['a','b']]{% else %}[['b', 'c']]{% endif %}"
     validate_telegram_keyboard(keyboard_template)
Esempio n. 12
0
 def test_valid_with_template_inside(self):
     keyboard_template = "[['{{response.value}}','{% if pattern.condition %}{{ pattern.condition }}{% else %}back{% endif %}']]"
     validate_telegram_keyboard(keyboard_template)
 def test_valid_template_with_time(self):
     keyboard_template = """[['Back'],['{% now 'local' %}']]"""
     validate_telegram_keyboard(keyboard_template)