4IRL / urls4irl

Sharing URL's with friends.
3 stars 0 forks source link

CLI for mock data, tests for CLI #205

Closed GPropersi closed 1 month ago

GPropersi commented 1 month ago

Integrates into the Flask CLI to allow adding mock data to the development database, as well as clearing tables and dropping tables from the development and test databases.

From the updated README:

`flask addmock users`                   Adds 5 mock users with their emails validated
`flask addmock utubs`                   Adds 5 UTubs, this can be repeated to create multiple duplicate UTubs with same name. Runs users command first.
`flask addmock utubs --no-dupes`        Creates 5 UTubs but won't if UTub with name already exists. Runs users command first.
`flask addmock utubmembers`             Adds all users to all UTubs, even duplicates. Runs utubs commmand first.
`flask addmock utubmembers --no-dupes`  Adds all users to all UTubs, even duplicates. Does not create duplicate UTubs.
`flask addmock urls`                    Adds 5 URLs to all UTubs, runs utubmembers command first
`flask addmock urls --no-dupes`         Adds 5 URLs to all UTubs, without creating duplicate UTubs.
`flask addmock tags`                    Adds 5 tags to each URL in each UTub, runs urls command first. 
`flask addmock tags --no-dupes`         Adds 5 tags to each URL in each UTub, without creating duplicate UTubs.
`flask addmock all`                     Equivalent to `flask addmock tags`
`flask addmock all --no-dupes`          Equivalent to `flask addmock tags --no-dupes`
`flask managedb clear [test|dev]`       Clears each table, can specify either test or dev database
`flask managedb drop [test|dev]`        Drops all tables in the datbase, can specify either test or dev database

Note that some of these commands assume a predefined set of environment variables defining the database URI for either test or development.

Follow any commend with command with --help to see a list of options for that given command.

For example:

`flask addmock --help`
`flask managedb --help`
`flask addmock utubs --help`