openzim / cms

ZIM file Publishing Platform
https://cms.openzim.org
GNU General Public License v3.0
4 stars 0 forks source link

Create UI-testing fixtures #43

Closed rgaudin closed 2 years ago

rgaudin commented 2 years ago

In order to test UI, we need to have sample data: books, titles, with their tags and metadata.

This can be static model use within a dedicated backend.demo module that gets called using an invoke task.

anshulxyz commented 2 years ago

@rgaudin can you tell me more about how I should design the demo. Can it be a single script that generates a test database?

Like "invoke seed-test-DB"

rgaudin commented 2 years ago

A command like invoke load-demo-fixture that would do something like ensure it can be imported (using sys.path if required) and from backend_demo import load_fixture()

That function being something like:


def load_fixture():
    book = Book(id="xxxx", ...)
    title = Title(...)

The idea is that the fixture should be code that can be run and versioned. Simple model instance creation, like in the tests. We don't want something complicated ; just enough data for the UI to be tested without real data.

We'd want it outside our backend module as this is not useful code and we don't want to test/cover it.

rgaudin commented 2 years ago

Realized the titles in the fixture have no data. Those are just linked to books but there is no metadata/language/tags n the titles, making them unusable and thus preventing us from testing UI properly

anshulxyz commented 2 years ago

@rgaudin understood, fixing it now!