Skip to content

aezell/tedis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

=====
Tedis
=====

What is it?
-----------
Tedis is a class providing some simple tools to use when testing code that 
uses Redis as a queue.

The idea is that a user can provide a template with specially formatted
text, such that the code can do replacements in the text according to rules
given inside the placeholders.

Tedis exists because I wanted a quick and easy way to put a ton of data into 
Redis with a given format and key. I have no plans to support other backends.

Example Usage
-------------

>>> from tedis import Tedis

>>> template = "Integer: {{int:6}} | Alpha: {{ str:10:alpha }} | Alphapunc: {{str:15:alphapunc}} | Alphanumeric: {{str:6:alphanumeric}}"
>>> tester = Tedis(server = 'localhost:6379', redis_key = 'bacon')
>>> tester.load(template, 10000)
>>> tester.dump()
>>> tester.close()

The class will then write the given number of elements to the Redis server
making each random so that testing can be more reliable.

Note: Because the string creation is random, if you specify `alphanumeric` 
as the string flavor there's no guarantee (yet) that it will contain both 
letters and digits.

TODO
----
- Let the user create different types of objects for the template itself (JSON, class, etc.).
X Let strings be alphabetical, alphanumeric, or contain punctuation.
- Make the key a class property so user can change it during the session.
- Handle template miscues gracefully.

About

Get testing data into Redis easily with templates

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages