Esempio n. 1
0
    def test_table_definition(self):
        """ Tests that creating a table with capitalized column names succeedso """
        create_table(LowercaseKeyModel)
        create_table(CapitalizedKeyModel)

        delete_table(LowercaseKeyModel)
        delete_table(CapitalizedKeyModel)
Esempio n. 2
0
    def test_multiple_deletes_dont_fail(self):
        """

        """
        create_table(TestModel)

        delete_table(TestModel)
        delete_table(TestModel)
    def test_concrete_class_table_creation_cycle(self):
        """ Tests that models with inherited abstract classes can be created, and have io performed """
        from cqlengine.management import create_table, delete_table
        create_table(ConcreteModelWithCol)

        w1 = ConcreteModelWithCol.create(pkey=5, data=6)
        w2 = ConcreteModelWithCol.create(pkey=6, data=7)

        r1 = ConcreteModelWithCol.get(pkey=5)
        r2 = ConcreteModelWithCol.get(pkey=6)

        assert w1.pkey == r1.pkey
        assert w1.data == r1.data
        assert w2.pkey == r2.pkey
        assert w2.data == r2.data

        delete_table(ConcreteModelWithCol)
    def test_concrete_class_table_creation_cycle(self):
        """ Tests that models with inherited abstract classes can be created, and have io performed """
        from cqlengine.management import create_table, delete_table
        create_table(ConcreteModelWithCol)

        w1 = ConcreteModelWithCol.create(pkey=5, data=6)
        w2 = ConcreteModelWithCol.create(pkey=6, data=7)

        r1 = ConcreteModelWithCol.get(pkey=5)
        r2 = ConcreteModelWithCol.get(pkey=6)

        assert w1.pkey == r1.pkey
        assert w1.data == r1.data
        assert w2.pkey == r2.pkey
        assert w2.data == r2.data

        delete_table(ConcreteModelWithCol)
Esempio n. 5
0
    def setUpClass(cls):
        super(BaseQuerySetUsage, cls).setUpClass()
        delete_table(TestModel)
        delete_table(IndexedTestModel)
        create_table(TestModel)
        create_table(IndexedTestModel)
        create_table(TestMultiClusteringModel)

        TestModel.objects.create(test_id=0, attempt_id=0, description='try1', expected_result=5, test_result=30)
        TestModel.objects.create(test_id=0, attempt_id=1, description='try2', expected_result=10, test_result=30)
        TestModel.objects.create(test_id=0, attempt_id=2, description='try3', expected_result=15, test_result=30)
        TestModel.objects.create(test_id=0, attempt_id=3, description='try4', expected_result=20, test_result=25)

        TestModel.objects.create(test_id=1, attempt_id=0, description='try5', expected_result=5, test_result=25)
        TestModel.objects.create(test_id=1, attempt_id=1, description='try6', expected_result=10, test_result=25)
        TestModel.objects.create(test_id=1, attempt_id=2, description='try7', expected_result=15, test_result=25)
        TestModel.objects.create(test_id=1, attempt_id=3, description='try8', expected_result=20, test_result=20)

        TestModel.objects.create(test_id=2, attempt_id=0, description='try9', expected_result=50, test_result=40)
        TestModel.objects.create(test_id=2, attempt_id=1, description='try10', expected_result=60, test_result=40)
        TestModel.objects.create(test_id=2, attempt_id=2, description='try11', expected_result=70, test_result=45)
        TestModel.objects.create(test_id=2, attempt_id=3, description='try12', expected_result=75, test_result=45)

        IndexedTestModel.objects.create(test_id=0, attempt_id=0, description='try1', expected_result=5, test_result=30)
        IndexedTestModel.objects.create(test_id=1, attempt_id=1, description='try2', expected_result=10, test_result=30)
        IndexedTestModel.objects.create(test_id=2, attempt_id=2, description='try3', expected_result=15, test_result=30)
        IndexedTestModel.objects.create(test_id=3, attempt_id=3, description='try4', expected_result=20, test_result=25)

        IndexedTestModel.objects.create(test_id=4, attempt_id=0, description='try5', expected_result=5, test_result=25)
        IndexedTestModel.objects.create(test_id=5, attempt_id=1, description='try6', expected_result=10, test_result=25)
        IndexedTestModel.objects.create(test_id=6, attempt_id=2, description='try7', expected_result=15, test_result=25)
        IndexedTestModel.objects.create(test_id=7, attempt_id=3, description='try8', expected_result=20, test_result=20)

        IndexedTestModel.objects.create(test_id=8, attempt_id=0, description='try9', expected_result=50, test_result=40)
        IndexedTestModel.objects.create(test_id=9, attempt_id=1, description='try10', expected_result=60,
                                        test_result=40)
        IndexedTestModel.objects.create(test_id=10, attempt_id=2, description='try11', expected_result=70,
                                        test_result=45)
        IndexedTestModel.objects.create(test_id=11, attempt_id=3, description='try12', expected_result=75,
                                        test_result=45)
Esempio n. 6
0
 def tearDownClass(cls):
     super(TestQuerying, cls).tearDownClass()
     delete_table(TestQueryModel)
Esempio n. 7
0
 def tearDownClass(cls):
     super(TestMinMaxTimeUUIDFunctions, cls).tearDownClass()
     delete_table(TimeUUIDQueryModel)
Esempio n. 8
0
 def tearDownClass(cls):
     super(BatchQueryTests, cls).tearDownClass()
     delete_table(TestMultiKeyModel)
Esempio n. 9
0
 def tearDownClass(cls):
     super(TestMinMaxTimeUUIDFunctions, cls).tearDownClass()
     delete_table(TimeUUIDQueryModel)
 def tearDownClass(cls):
     super(TestDateTimeQueries, cls).tearDownClass()
     delete_table(DateTimeQueryTestModel)
Esempio n. 11
0
 def setUpClass(cls):
     super(TestDeleting, cls).setUpClass()
     delete_table(TestMultiKeyModel)
     create_table(TestMultiKeyModel)
Esempio n. 12
0
 def tearDownClass(cls):
     super(TestUpdating, cls).tearDownClass()
     delete_table(TestMultiKeyModel)
Esempio n. 13
0
 def tearDownClass(cls):
     super(BatchQueryTests, cls).tearDownClass()
     delete_table(TestMultiKeyModel)
Esempio n. 14
0
 def setUpClass(cls):
     super(BatchQueryTests, cls).setUpClass()
     delete_table(TestMultiKeyModel)
     create_table(TestMultiKeyModel)
Esempio n. 15
0
 def tearDownClass(cls):
     super(BaseColumnIOTest, cls).tearDownClass()
     if not cls.column:
         return
     delete_table(cls._generated_model)
Esempio n. 16
0
 def setUp(self):
     delete_table(PrimaryKeysOnlyModel)
Esempio n. 17
0
 def setUpClass(cls):
     super(TestCanUpdate, cls).setUpClass()
     delete_table(TestModel)
     create_table(TestModel)
Esempio n. 18
0
 def setUpClass(cls):
     super(TestCounterColumn, cls).setUpClass()
     delete_table(TestCounterModel)
     create_table(TestCounterModel)
Esempio n. 19
0
 def tearDownClass(cls):
     super(TestModelIO, cls).tearDownClass()
     delete_table(TestModel)
Esempio n. 20
0
 def tearDownClass(cls):
     super(TestCounterColumn, cls).tearDownClass()
     delete_table(TestCounterModel)
Esempio n. 21
0
 def tearDownClass(cls):
     super(TestCanUpdate, cls).tearDownClass()
     delete_table(TestModel)
Esempio n. 22
0
 def tearDownClass(cls):
     super(TestDecimal, cls).tearDownClass()
     delete_table(cls.DecimalTest)
 def tearDownClass(cls):
     super(TestEqualityOperators, cls).tearDownClass()
     delete_table(TestModel)
Esempio n. 24
0
 def tearDownClass(cls):
     super(TestTimeUUID, cls).tearDownClass()
     delete_table(cls.TimeUUIDTest)
 def setUpClass(cls):
     super(TestSetColumn, cls).setUpClass()
     delete_table(TestSetModel)
     create_table(TestSetModel)
Esempio n. 26
0
 def tearDownClass(cls):
     super(TestDatetime, cls).tearDownClass()
     delete_table(cls.DatetimeTest)
Esempio n. 27
0
 def setUpClass(cls):
     super(BatchQueryTests, cls).setUpClass()
     delete_table(TestMultiKeyModel)
     create_table(TestMultiKeyModel)
Esempio n. 28
0
 def tearDownClass(cls):
     super(TestVarInt, cls).tearDownClass()
     delete_table(cls.VarIntTest)
Esempio n. 29
0
 def tearDownClass(cls):
     super(BaseQuerySetUsage, cls).tearDownClass()
     delete_table(TestModel)
     delete_table(IndexedTestModel)
     delete_table(TestMultiClusteringModel)
 def tearDownClass(cls):
     super(TestClusteringOrder, cls).tearDownClass()
     delete_table(TestModel)
Esempio n. 31
0
 def setUpClass(cls):
     super(TestQuerying, cls).setUpClass()
     delete_table(TestQueryModel)
     create_table(TestQueryModel)
Esempio n. 32
0
 def tearDownClass(cls):
     super(TestDecimal, cls).tearDownClass()
     delete_table(cls.DecimalTest)
Esempio n. 33
0
 def tearDownClass(cls):
     super(TestUpdating, cls).tearDownClass()
     delete_table(TestMultiKeyModel)
Esempio n. 34
0
 def tearDownClass(cls):
     super(TestTimeUUID, cls).tearDownClass()
     delete_table(cls.TimeUUIDTest)
Esempio n. 35
0
 def tearDownClass(cls):
     super(TestCanUpdate, cls).tearDownClass()
     delete_table(TestModel)
Esempio n. 36
0
 def tearDownClass(cls):
     super(TestDatetime, cls).tearDownClass()
     delete_table(cls.DatetimeTest)
Esempio n. 37
0
 def setUpClass(cls):
     super(TestDeleting, cls).setUpClass()
     delete_table(TestMultiKeyModel)
     create_table(TestMultiKeyModel)
Esempio n. 38
0
 def tearDownClass(cls):
     super(TestVarInt, cls).tearDownClass()
     delete_table(cls.VarIntTest)
Esempio n. 39
0
 def setUpClass(cls):
     super(TestCanUpdate, cls).setUpClass()
     delete_table(TestModel)
     create_table(TestModel)
 def tearDownClass(cls):
     super(TestSetColumn, cls).tearDownClass()
     delete_table(TestSetModel)
Esempio n. 41
0
 def tearDownClass(cls):
     super(TestModelIO, cls).tearDownClass()
     delete_table(TestModel)
Esempio n. 42
0
 def setUpClass(cls):
     super(TestListColumn, cls).setUpClass()
     delete_table(TestListModel)
     create_table(TestListModel)
Esempio n. 43
0
 def setUp(self):
     delete_table(FirstModel)
Esempio n. 44
0
 def tearDownClass(cls):
     super(TestEqualityOperators, cls).tearDownClass()
     delete_table(TestModel)
Esempio n. 45
0
 def tearDownClass(cls):
     super(TestClusteringOrder, cls).tearDownClass()
     delete_table(TestModel)
Esempio n. 46
0
    def setUpClass(cls):
        super(BaseQuerySetUsage, cls).setUpClass()
        delete_table(TestModel)
        delete_table(IndexedTestModel)
        create_table(TestModel)
        create_table(IndexedTestModel)
        create_table(TestMultiClusteringModel)

        TestModel.objects.create(test_id=0,
                                 attempt_id=0,
                                 description='try1',
                                 expected_result=5,
                                 test_result=30)
        TestModel.objects.create(test_id=0,
                                 attempt_id=1,
                                 description='try2',
                                 expected_result=10,
                                 test_result=30)
        TestModel.objects.create(test_id=0,
                                 attempt_id=2,
                                 description='try3',
                                 expected_result=15,
                                 test_result=30)
        TestModel.objects.create(test_id=0,
                                 attempt_id=3,
                                 description='try4',
                                 expected_result=20,
                                 test_result=25)

        TestModel.objects.create(test_id=1,
                                 attempt_id=0,
                                 description='try5',
                                 expected_result=5,
                                 test_result=25)
        TestModel.objects.create(test_id=1,
                                 attempt_id=1,
                                 description='try6',
                                 expected_result=10,
                                 test_result=25)
        TestModel.objects.create(test_id=1,
                                 attempt_id=2,
                                 description='try7',
                                 expected_result=15,
                                 test_result=25)
        TestModel.objects.create(test_id=1,
                                 attempt_id=3,
                                 description='try8',
                                 expected_result=20,
                                 test_result=20)

        TestModel.objects.create(test_id=2,
                                 attempt_id=0,
                                 description='try9',
                                 expected_result=50,
                                 test_result=40)
        TestModel.objects.create(test_id=2,
                                 attempt_id=1,
                                 description='try10',
                                 expected_result=60,
                                 test_result=40)
        TestModel.objects.create(test_id=2,
                                 attempt_id=2,
                                 description='try11',
                                 expected_result=70,
                                 test_result=45)
        TestModel.objects.create(test_id=2,
                                 attempt_id=3,
                                 description='try12',
                                 expected_result=75,
                                 test_result=45)

        IndexedTestModel.objects.create(test_id=0,
                                        attempt_id=0,
                                        description='try1',
                                        expected_result=5,
                                        test_result=30)
        IndexedTestModel.objects.create(test_id=1,
                                        attempt_id=1,
                                        description='try2',
                                        expected_result=10,
                                        test_result=30)
        IndexedTestModel.objects.create(test_id=2,
                                        attempt_id=2,
                                        description='try3',
                                        expected_result=15,
                                        test_result=30)
        IndexedTestModel.objects.create(test_id=3,
                                        attempt_id=3,
                                        description='try4',
                                        expected_result=20,
                                        test_result=25)

        IndexedTestModel.objects.create(test_id=4,
                                        attempt_id=0,
                                        description='try5',
                                        expected_result=5,
                                        test_result=25)
        IndexedTestModel.objects.create(test_id=5,
                                        attempt_id=1,
                                        description='try6',
                                        expected_result=10,
                                        test_result=25)
        IndexedTestModel.objects.create(test_id=6,
                                        attempt_id=2,
                                        description='try7',
                                        expected_result=15,
                                        test_result=25)
        IndexedTestModel.objects.create(test_id=7,
                                        attempt_id=3,
                                        description='try8',
                                        expected_result=20,
                                        test_result=20)

        IndexedTestModel.objects.create(test_id=8,
                                        attempt_id=0,
                                        description='try9',
                                        expected_result=50,
                                        test_result=40)
        IndexedTestModel.objects.create(test_id=9,
                                        attempt_id=1,
                                        description='try10',
                                        expected_result=60,
                                        test_result=40)
        IndexedTestModel.objects.create(test_id=10,
                                        attempt_id=2,
                                        description='try11',
                                        expected_result=70,
                                        test_result=45)
        IndexedTestModel.objects.create(test_id=11,
                                        attempt_id=3,
                                        description='try12',
                                        expected_result=75,
                                        test_result=45)
Esempio n. 47
0
 def tearDownClass(cls):
     super(TestListColumn, cls).tearDownClass()
     delete_table(TestListModel)
Esempio n. 48
0
 def tearDownClass(cls):
     super(BaseQuerySetUsage, cls).tearDownClass()
     delete_table(TestModel)
     delete_table(IndexedTestModel)
     delete_table(TestMultiClusteringModel)
Esempio n. 49
0
 def tearDownClass(cls):
     super(BaseColumnIOTest, cls).tearDownClass()
     if not cls.column: return
     delete_table(cls._generated_model)
Esempio n. 50
0
 def tearDownClass(cls):
     super(TestDateTimeQueries, cls).tearDownClass()
     delete_table(DateTimeQueryTestModel)