/interfaces-storages

An Image storage app that applies interfaces and dependency injection for better code quality. Providers include AWS_S3, local disk storage

Primary LanguagePython

Interfaces (Storages)

codecov Test status Build Status

Description

This project involves the application of design patterns to develop an image storage app with the following advantages:

  • High extensibility (Storage Providers' function definitions like for dropbox can be added without complicating the codebase at all)
  • Dependency change does not fail the system

Concepts applied

  • Storage providers: Aws_S3, local disk storage
  • Interfaces
  • Dependency Injection
  • Test driven development

Adding Providers

add commandline argument for the new provider in the tests file Make sure the test_databases.py tests even when unchanged pass for your newly added providers' logic

Running Tests

pip install coverage
Run tests for each provider in this format:
coverage run tests\test_storages.py aws_s3
where "aws_s3" is one of:

  • aws_s3
  • filesystem

Getting coverage

use -a to append individual tests
coverage run tests\test_storages.py aws_s3 && coverage run -a tests\test_storages.py filesystem
then
coverage report

Environment files

Add these files in the /providers folder before running.

.env for aws_s3

aws_access_key_id = ***
aws_secret_access_key = ***
region=***