Ejemplo n.º 1
0
 def test_incr(self):
     element = Counter(variable_name="var", incr=2)
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['result']['CounterConfig']['stringProp']:
         if tag['@name'] == 'CounterConfig.incr':
             assert tag['#text'] == '2'
Ejemplo n.º 2
0
    def test_reset(self):
        element = Counter(variable_name="var",
                          per_user=True,
                          reset_on_tg_iteration=True)
        rendered_doc = tag_wrapper(element.to_xml(), 'result')
        parsed_doc = xmltodict.parse(rendered_doc)

        for tag in parsed_doc['result']['CounterConfig']['boolProp']:
            if tag['@name'] == 'CounterConfig.reset_on_tg_iteration':
                assert tag['#text'] == 'true'
Ejemplo n.º 3
0
 def test_positive(self):
     Counter(variable_name="var",
             per_user=True,
             reset_on_tg_iteration=True)
Ejemplo n.º 4
0
 def test_type_check(self):
     with pytest.raises(TypeError):
         Counter(variable_name=123)
Ejemplo n.º 5
0
 def test_type_check1(self):
     with pytest.raises(TypeError):
         Counter(variable_name="var",
                 per_user=True,
                 reset_on_tg_iteration="True")
Ejemplo n.º 6
0
 def test_type_check(self):
     with pytest.raises(ValueError):
         Counter(variable_name="var", reset_on_tg_iteration=True)
Ejemplo n.º 7
0
 def test_positive(self):
     Counter(variable_name="var", per_user=True)
Ejemplo n.º 8
0
 def test_type_check1(self):
     with pytest.raises(TypeError):
         Counter(variable_name="var", per_user=1)
Ejemplo n.º 9
0
 def test_positive(self):
     Counter(variable_name="var", incr=10)
Ejemplo n.º 10
0
 def test_type_check(self):
     with pytest.raises(TypeError):
         Counter(variable_name="var", incr="1")
Ejemplo n.º 11
0
 def test_positive(self):
     Counter(variable_name="var", end=1)
Ejemplo n.º 12
0
 def test_type_check2(self):
     with pytest.raises(ValueError):
         Counter(variable_name="var", start=2, end=1)
Ejemplo n.º 13
0
 def test_type_check1(self):
     with pytest.raises(TypeError):
         Counter(variable_name="var", start=-1)
Ejemplo n.º 14
0
 def test_positive(self):
     Counter(variable_name="var", format_="user")
Ejemplo n.º 15
0
 def test_hashtree_contain(self):
     element = Counter(variable_name="var")
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     assert '<hashTree />' in rendered_doc
Ejemplo n.º 16
0
 def test_per_user(self):
     element = Counter(variable_name="var", per_user=True)
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     assert parsed_doc['result']['CounterConfig']['boolProp'][
         '#text'] == 'true'