def test_can_be_upserted_in_a_transaction(self): self.make_package(description='Before') with self.db.get_cursor() as cursor: Package.upsert(NPM, name='foo', description='After', emails=[], cursor=cursor) assert Foo().description == 'Before' assert Foo().description == 'After'
def test_can_be_updated_via_upsert(self): self.make_package() Package.upsert(NPM, name='foo', description='Bar!', emails=[]) assert Foo().description == 'Bar!'
def test_can_be_inserted_via_upsert(self): Package.upsert(NPM, name='foo', description='Foo!', emails=[]) assert Foo().name == 'foo'