CivicSpleen / ambry

A comprehensive data package manager
BSD 2-Clause "Simplified" License
4 stars 5 forks source link

Migrate Tests to New Library Model #187

Open ericbusboom opened 8 years ago

ericbusboom commented 8 years ago

I've added ( on the develop branch ) a new base class for tests that should simplify database and library construction a lot.

It uses the test.proto.ProtoLibrary to create Sqlite and Postgres Libraries. The class can build a set of bundles and store them in either a Sqlite database, or Postgres template, so a populated library can be constructed very quickly. It also does not use the user's config file, so There is less chance of screwing up a real library.

In tests, the library should be created using TestBase.library(). WIth use_proto=False, it will return a new, unpopulated library. The postgres DSN is set with an env var, ABRY_TEST_DB, as before.

1) Clear out all of the database and library construction code from other tests, and convert them all to use this library.

Some of the code to remove:

I used test_base.PostgreSQLTestBase for a lot of the code in ProtoLibrary, so it should not be necessary any more.

Then, fix the Warehouse tests to use the new system.