Skip to content

caulagi/py-ras

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rent-a-slogan

Build Status Codacy Badge

A Python solution using uvloop and asyncpg. See README for problem description. The recommended python version is 3.6.x.

Running locally

$ docker volume create rent_slogan
$ docker run \
    -v rent-slogan:/var/lib/postgresql/data \
    -e POSTGRES_PASSWORD=1234 \
    -e POSTGRES_DB=rent_slogan \
    -p 5432:5432 \
    -d postgres:9.6-alpine

$ python3 -m venv ~/.venv/ras
$ source ~/.venv/ras/bin/activate

Dependencies

# for just running the project
$ pip install -r requirements.txt

# for running tests and code quality checks
$ pip install -r test/requirements.txt

Finally...

$ python -m server
$ nc localhost 25001
status
Total number of slogans: 10
Number of rents: 2
Number of connected clients: 3

add::Just do it
Just do it
add::Just do it
error: slogan already exists

rent
OK: id:4 title:t1
Slogan id 4 has expired

Tests

py.test