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))
    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"))