fixtures

Databases allow bad foreign keys from Rails Fixtures

Hi, I am using Rails Fixtures to load some test data to my database and accidentally I introduced a foreign key out of range. To my surprise, the database accepted it despite having referential integrity constraints (that work). I tried with PostgreSQL and with MySQL InnoDB and both allowed. Example: Having in the database "Flavour...

How to setup web2py fixtures

I'm trying to find a way to create fixtures for my web2py application. I came across http://thadeusb.com/weblog/2010/4/21/using_fixtures_in_web2py that suggests creating a x_fixtures.py file to place all the fixtures in. The problem is that after a while, the file gets huge and a pain to navigate through. What I want to be able to do i...

How do I prevent fixtures from conflicting with django post_save signal code?

In my application, I want to create entries in certain tables when a new user signs up. For instance, I want to create a userprofile which will then reference their company and some other records for them. I implemented this with a post_save signal: def callback_create_profile(sender, **kwargs): # check if we are creating a new User...

How are IDs for fixtures generated?

I'm using fixtures to hold all the test data that I have. Each row in my DB has the same ID across several rake db:fixtures:loads. That is nice, because I can create folders in the project, like "people/12345" to hold additional data (files) for the models. I'm interested to know, how are these generated IDs kept constant at every fix...

How do I use Fixtures.identify?

What are the parameters and what is the significance of them? ...

google-app-engine-django loading fixtures

I'm having troubles loading fixtures on GAE with google-app-engine-django. I receive an error that says "DeserializationError: Invalid model identifier: 'fcl.User'" ./manage.py loaddata users I'm trying to load a fixture that has the following data: - model: fcl.User fields: firstname: test lastname:...

Ruby on Rails: Unable to assign attributes to models built in unit tests

I'm trying to test creation of a new model inside my unit tests, and I'm getting some puzzling behavior. In this example, I already have a fixture that define an Article :valid_article: public_review = Review.new({:article => articles(:valid_article)}) assert !public_review.article_id.nil? Oddly enough, this fails the assertion, beca...

Creating fixtures out of other fixtures in Rails

I'm using acts_as_versioned for versioning a model Post. The plugin basically allows versioning a model by using an additional table that stores the different versions of each post. In my tests, I have defined some posts in posts.yml. However, the fixtures with the initial versions for this posts (in file posts_versions.yml) have to be ...

In Django, getting a "Error: Unable to serialize database" when trying to dump data?

Hello. I'm getting an error when I'm trying to dump data to a JSON fixture in Djanog 1.2.1 on my live server. On the live server it's running MySQL Server version 5.0.77 and I imported a lot of data to my tables using the phpMyAdmin interface. The website works fine and Django admin responds as normal. But when I try and actually dump t...

How to find changes in a table relative to an initial SQL fixture?

I have a number of tests that run against a MySQL database which is pre-loaded with schemas and example data from a set of SQL files. Some of these tests, during their run, also create new data in the database. Normally, tests are responsible for cleaning up after themselves (and thus not polluting the database environment for other tes...

Doctrine fixtures - circular references

Is there any way to load fixtures that have circular referencing? As an example I have the following fixture: BusinessEntityTeam: Nicole_Team: name: Nicole's Team Manager: [Nicole] Business: [ACMEWidgets] sfGuardUser Nicole: first_name: Nicole last_name: Jones email_address: [email protected] ...

Rails3: How to recreate test fixtures based on development database schema (newbie)

The situation: I used generate scaffold to set up my objects in a new Rails project. Besides doing some migrations, I also directly edited the MySQL tables by adding and renaming columns etc. Now I can't get tests to run because the automatically-generated fixtures do not correspond to the database schema. Perhaps they're based on the or...

Problem loading Django fixture: IntegrityError: (1062, "Duplicate entry '4' for key 'user_id'")

I used the following commands to generate 2 fixtures: ./manage.py dumpdata --format=json --indent=4 --natural auth.User > fixtures/user.json ./manage.py dumpdata --format=json --indent=4 --natural --exclude=contenttypes --exclude=auth > fixtures/full.json I've got the following fixture named user.json: [ { "pk": 4, ...

Rails3: Find method not working with fixtures in test environment

The Rails Guide says, "Fixtures can also transform themselves into the form of the original class. Thus, you can get at the methods only available to that class," and gives the example, # using the find method, we grab the "real" david as a User david = users(:david).find My fixtures are working ok, but when I try memb = member...

In Rails 3, I'm getting a NoMethodError for the recycle! method during testing

Hello, I've got a functional test that's using fixtures. I also am using fixtures in my Unit tests, but they work without flaw. When running the functional tests, I get a: NoMethodError: undefined method 'recycle!' for #<Response:0x10346be10> /test/functional/responses_controller_test.rb:10:in 'test_testing' My functional tests, at ...

Getting a "has no column named" When Loading Rails Fixtures

EDIT: This is with Rails 2.3.5 For some reason, when I try to associate a CreditCard with Band in my project, I get the following errors SQLite3::SQLException: table credit_cards has no column named band: INSERT INTO "credit_cards" ("created_at", "vault_token", "billing_zipcode", "billing_first_name", "updated_at", "band", "billing_sta...

Maximum Recursion depth exceeded when installing Django Fixture

When running a Django unit test, it try's to install a fixture (initial_data.json) to the db, but fails everytime due to Runtime Error: maximum recursion depth exceeded while calling Python object Any idea what's going on? Edit: Django 1.2.3 and Python 2.7 ...

RSpec : want to have many tests for one shot method, including fixtures

Hello, I'm working on a Rails app. I want to test with rspec my method "start!" of my model Backup. So here the specs (all are methods, too): Backup should copy files to folder /backups Backup should check md5 sum Backup should delete original files For my tests, I create fake files, based on fixtures : MyFile.all.each{|r| system(...

Migrating Django fixtures?

I have a Django application. I have .json fixture files containing test data, with unit tests that use the data to confirm the application is working properly. I also use South to migrate my database. After doing a few database migrations, my fixtures are out of date, because the database has migrated, adding a new database column, ...

Cocos 2d body & its fixtures

Hi there, Well I try to implement the run action to move a specific sprite towards the specific destination, I can achieve that using the below code snippet. [spriteA runAction:[CCSequence actions:[CCMoveTo actionWithDuration:0.2 position:realDest],[CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)],nil]]; But ...