def test_query_correctly_handled(self):
     self.Artist.create(name='John')
     self.Artist.create(name='Andrei')
     with get_conn() as conn:
         # order_by should be correctly handled by self.Artist
         results = list(self.Artist.order_by('name').run(conn))
     assert results[0]['name'] == 'Andrei'
     assert results[1]['name'] == 'John'
Beispiel #2
0
 def test_query_correctly_handled(self):
     self.Artist.create(name='John')
     self.Artist.create(name='Andrei')
     with get_conn() as conn:
         # order_by should be correctly handled by self.Artist
         results = list(self.Artist.order_by('name').run(conn))
     assert results[0]['name'] == 'Andrei'
     assert results[1]['name'] == 'John'
Beispiel #3
0
    def setUp(self):
        super(DbBaseTestCase, self).setUp()

        # Create new database and switch to it
        try:
            with get_conn() as conn:
                r.db_create('testing').run(conn)
                conn.use('testing')
        except RqlDriverError:
            raise unittest.SkipTest('RethinkDB is unaccessible')
Beispiel #4
0
 def test_custom_query_correctly_handled(self):
     a = self.Artist()
     a.save()
     a['tastes'].create(name='House')
     a['tastes'].create(name='Classical')
     with get_conn() as conn:
         # order_by should be correctly handled by a['tastes']
         results = list(a['tastes'].order_by('name').run(conn))
     assert results[0]['name'] == 'Classical'
     assert results[1]['name'] == 'House'
Beispiel #5
0
 def test_custom_query_correctly_handled(self):
     a = self.Artist()
     a.save()
     a['songs'].create(name='Sandstorm')
     a['songs'].create(name='Rocket')
     with get_conn() as conn:
         # order_by should be correctly handled by a['songs']
         results = list(a['songs'].order_by('name').run(conn))
     assert results[0]['name'] == 'Rocket'
     assert results[1]['name'] == 'Sandstorm'
Beispiel #6
0
 def test_custom_query_correctly_handled(self):
     a = self.Artist()
     a.save()
     a['tastes'].create(name='House')
     a['tastes'].create(name='Classical')
     with get_conn() as conn:
         # order_by should be correctly handled by a['tastes']
         results = list(a['tastes'].order_by('name').run(conn))
     assert results[0]['name'] == 'Classical'
     assert results[1]['name'] == 'House'
Beispiel #7
0
 def test_custom_query_correctly_handled(self):
     a = self.Artist()
     a.save()
     a['songs'].create(name='Sandstorm')
     a['songs'].create(name='Rocket')
     with get_conn() as conn:
         # order_by should be correctly handled by a['songs']
         results = list(a['songs'].order_by('name').run(conn))
     assert results[0]['name'] == 'Rocket'
     assert results[1]['name'] == 'Sandstorm'
Beispiel #8
0
    def setUp(self):
        super(DbBaseTestCase, self).setUp()

        # Create new database and switch to it
        try:
            with get_conn() as conn:
                r.db_create('testing').run(conn)
                conn.use('testing')
        except RqlDriverError:
            raise unittest.SkipTest('RethinkDB is unaccessible')
Beispiel #9
0
    def tearDown(self):
        super(DbBaseTestCase, self).tearDown()

        # Drop test database
        with get_conn() as conn:
            r.db_drop('testing').run(conn)
Beispiel #10
0
    def tearDown(self):
        super(DbBaseTestCase, self).tearDown()

        # Drop test database
        with get_conn() as conn:
            r.db_drop('testing').run(conn)