Beispiel #1
0
    def test_flush(self):
        record = Baz()
        self.db.add(record)

        self.assertIsNone(record._id)

        record.flush()

        self.assertIsNotNone(record._id)
Beispiel #2
0
    def test_delete(self):
        record = Baz()
        self.db.add_commit(record)

        _id = record._id

        self.assertIsNotNone(Baz.get(_id))

        record.delete()
        self.db.commit()

        self.assertIsNone(Baz.get(_id))
Beispiel #3
0
    def test_column_attrs(self):
        baz = Baz.get(1)

        # it should be a class and instance property
        self.assertEqual(Baz.column_attrs, baz.column_attrs)
        self.assertEqual(
            set(Baz.column_attrs),
            set([Baz._id.property, Baz.string.property, Baz.number.property, Baz.bar_id.property])
        )
Beispiel #4
0
    def test_relationships(self):
        baz = Baz.get(1)

        # it should be a class and instance property
        self.assertEqual(Baz.relationships, baz.relationships)
        self.assertEqual(set(Baz.relationships), set(['bar']))
Beispiel #5
0
    def test_descriptors(self):
        baz = Baz.get(1)

        # it should be a class and instance property
        self.assertEqual(Baz.descriptors, baz.descriptors)
        self.assertEqual(set(Baz.descriptors), set(['_id', 'string', 'number', 'bar_id', 'bar', 'hybrid_number']))
Beispiel #6
0
    def test_columns(self):
        baz = Baz.get(1)

        # it should be a class and instance property
        self.assertEqual(Baz.columns, baz.columns)
        self.assertEqual(set(Baz.columns), set(['_id', 'string', 'number', 'bar_id']))