From 5d45eccfefff8c64e97851244e0b807502ac8f9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Fri, 2 Jun 2023 17:08:20 +0200 Subject: [PATCH] feat: add django test command Added django's manage.py test command as a shortcut --- src/cli/django.rs | 3 +++ src/main.rs | 1 + src/scripts/django.rs | 12 ++++++++---- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/cli/django.rs b/src/cli/django.rs index 7626cfa..7164776 100644 --- a/src/cli/django.rs +++ b/src/cli/django.rs @@ -31,4 +31,7 @@ pub enum Django { /// Run Django's manage.py shell. Shell, + + /// Run Django's manage.py test. + Test, } diff --git a/src/main.rs b/src/main.rs index 8a8a76b..ea1f052 100644 --- a/src/main.rs +++ b/src/main.rs @@ -40,6 +40,7 @@ fn main() -> Result<()> { cli::Django::Manage { rest } => scripts::django::manage(&rest), cli::Django::Migrate { rest } => scripts::django::migrate(&rest), cli::Django::Shell => scripts::django::shell(), + cli::Django::Test => scripts::django::test(), }, cli::Commands::Postgres { command } => match command { cli::Postgres::Import { path } => scripts::postgres::import(&path), diff --git a/src/scripts/django.rs b/src/scripts/django.rs index c657c12..c9d3410 100644 --- a/src/scripts/django.rs +++ b/src/scripts/django.rs @@ -61,13 +61,17 @@ pub fn makemigrations() -> Result<()> { manage(&["makemigrations".to_string()]) } -pub fn shell() -> Result<()> { - manage(&["shell".to_string()]) -} - pub fn migrate(rest: &[String]) -> Result<()> { let mut full_rest = vec!["migrate".to_string()]; full_rest.extend_from_slice(rest); manage(&full_rest) } + +pub fn shell() -> Result<()> { + manage(&["shell".to_string()]) +} + +pub fn test() -> Result<()> { + manage(&["test".to_string()]) +}