2021-01-20 23:13:37 +01:00
|
|
|
# Test code for django_manage module
|
|
|
|
#
|
2022-08-05 12:28:29 +02:00
|
|
|
# Copyright (c) 2020, Alexei Znamensky <russoz@gmail.com>
|
|
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
2021-01-20 23:13:37 +01:00
|
|
|
- name: Create temporary test directory
|
|
|
|
tempfile:
|
|
|
|
state: directory
|
|
|
|
suffix: .django_manage
|
|
|
|
register: tmp_django_root
|
|
|
|
|
2022-08-13 12:08:07 +02:00
|
|
|
- name: Install virtualenv on CentOS 8
|
2022-02-21 21:14:45 +01:00
|
|
|
package:
|
|
|
|
name: virtualenv
|
|
|
|
state: present
|
|
|
|
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '8'
|
|
|
|
|
2022-08-13 12:08:07 +02:00
|
|
|
- name: Install virtualenv on Arch Linux
|
|
|
|
pip:
|
|
|
|
name: virtualenv
|
2022-02-21 21:14:45 +01:00
|
|
|
state: present
|
|
|
|
when: ansible_os_family == 'Archlinux'
|
|
|
|
|
2021-01-20 23:13:37 +01:00
|
|
|
- name: Install required library
|
|
|
|
pip:
|
|
|
|
name: django
|
|
|
|
state: present
|
|
|
|
virtualenv: "{{ tmp_django_root.path }}/venv"
|
|
|
|
|
|
|
|
- name: Copy files
|
|
|
|
copy:
|
|
|
|
src: base_test/
|
|
|
|
dest: "{{ tmp_django_root.path }}"
|
|
|
|
mode: preserve
|
|
|
|
|
|
|
|
- name: Create project
|
|
|
|
command:
|
|
|
|
chdir: "{{ tmp_django_root.path }}/startproj"
|
|
|
|
cmd: "{{ tmp_django_root.path }}/venv/bin/django-admin startproject test_django_manage_1"
|
|
|
|
|
|
|
|
- name: Create app
|
|
|
|
command:
|
|
|
|
chdir: "{{ tmp_django_root.path }}/startproj"
|
|
|
|
cmd: "{{ tmp_django_root.path }}/venv/bin/django-admin startapp app1"
|
|
|
|
|
|
|
|
- name: Check
|
|
|
|
community.general.django_manage:
|
|
|
|
project_path: "{{ tmp_django_root.path }}/startproj/test_django_manage_1"
|
|
|
|
command: check
|
|
|
|
virtualenv: "{{ tmp_django_root.path }}/venv"
|
|
|
|
|
|
|
|
- name: Check simple_project
|
|
|
|
community.general.django_manage:
|
|
|
|
project_path: "{{ tmp_django_root.path }}/simple_project/p1"
|
|
|
|
command: check
|
|
|
|
virtualenv: "{{ tmp_django_root.path }}/venv"
|
|
|
|
|
|
|
|
- name: Check custom project
|
|
|
|
community.general.django_manage:
|
|
|
|
project_path: "{{ tmp_django_root.path }}/1045-single-app-project/single_app_project"
|
|
|
|
pythonpath: "{{ tmp_django_root.path }}/1045-single-app-project/"
|
|
|
|
command: check
|
|
|
|
virtualenv: "{{ tmp_django_root.path }}/venv"
|
2021-08-31 07:14:08 +02:00
|
|
|
|
|
|
|
- name: Run collectstatic --noinput on simple project
|
|
|
|
community.general.django_manage:
|
|
|
|
project_path: "{{ tmp_django_root.path }}/simple_project/p1"
|
|
|
|
command: collectstatic --noinput
|
|
|
|
virtualenv: "{{ tmp_django_root.path }}/venv"
|