Exemplo n.º 1
0
    def test_that_script_step_data_gets_deleted(self):
        cache = StepsCache()
        client = cache.get_redis_client()
        script_name = 'my_script'
        first_step = 'step 1 1'
        client.sadd(script_name, first_step)
        cache.key_name = Mock(return_value=script_name)
        cache.delete_script_steps_data(client)

        self.assertFalse(client.exists(script_name))
Exemplo n.º 2
0
    def test_that_data_from_api_is_stored(self):
        cache = StepsCache()
        key_name = "my script"
        first_value = "step 1 1"
        second_value = "step 1 2"
        data = [first_value, second_value]
        encoded_data = {first_value: "encrypted_first_value", second_value: "encrypted_second_value"}
        cache.key_name = Mock(return_value=key_name)
        cache.get_steps_information = Mock(return_value=data)
        cache.encode = encode_mock(encoded_data)

        client = cache.get_redis_client()
        cache.add_script_steps_data(client)

        self.assertTrue(client.sismember(key_name, "encrypted_first_value"))
        self.assertTrue(client.sismember(key_name, "encrypted_second_value"))
Exemplo n.º 3
0
 def test_that_key_name_is_ureport(self):
     cache = StepsCache()
     self.assertEquals(cache.key_name(), "ureport-registration-steps")
Exemplo n.º 4
0
 def test_that_encode_text_using_md5(self):
     cache = StepsCache()
     text = "important text"
     encoded_text = cache.encode(text)
     self.assertEquals(encoded_text, 'encrypted_value')