Ejemplo n.º 1
0
    def test_many_relations2(self):

        db.session.commit()
        db.drop_all()
        db.create_all()

        example3 = MSubtype("gobbo", 2, 2)
        db.session.add(example3)
        db.session.commit()

        exampleSet = MSet('ktk', "Khans of Tarkir", "1", "none", 5, "link",
                          [example3])
        db.session.add(exampleSet)
        db.session.commit()

        exampleSet2 = MSet('LEA', "Khans of Tarkir", "1", "none", 5, "link",
                           [example3])
        db.session.add(exampleSet2)
        db.session.commit()

        est = db.session.query(MSubtype).filter_by(name="gobbo").first()
        self.assertEqual(len(est.ssets.all()), 2)

        db.session.commit()
        db.drop_all()
Ejemplo n.º 2
0
    def test_ext_artist(self):

        db.session.commit()
        db.drop_all()
        db.create_all()

        example3 = MSubtype("gobbo", 2, 2)
        db.session.add(example3)
        db.session.commit()

        exampleSet = MSet('ktk', "Khans of Tarkir", "1", "none", 5, "link",
                          [example3])
        db.session.add(exampleSet)
        db.session.commit()

        example1 = MArtist('Thomas', 5, 5, [exampleSet])
        db.session.add(example1)
        db.session.commit()

        est = db.session.query(MArtist).filter_by(name="Thomas").first()
        self.assertEqual(est.name, "Thomas")
        self.assertEqual(est.numCards, 5)
        self.assertEqual(est.numSets, 5)
        self.assertEqual(est.sets, [exampleSet])

        db.session.commit()
        db.drop_all()
Ejemplo n.º 3
0
    def test_ext_set(self):

        db.session.commit()
        db.drop_all()
        db.create_all()

        example3 = MSubtype("gobbo", 2, 2)
        db.session.add(example3)
        db.session.commit()

        exampleSet = MSet('ktk', "Khans of Tarkir", "1", "none", 5, "link",
                          [example3])
        db.session.add(exampleSet)
        db.session.commit()

        est = db.session.query(MSet).filter_by(code="ktk").first()
        self.assertEqual(est.code, "ktk")
        self.assertEqual(est.name, "Khans of Tarkir")
        self.assertEqual(est.rDate, "1")
        self.assertEqual(est.block, "none")
        self.assertEqual(est.numCards, 5)
        self.assertEqual(est.symbol, "link")
        self.assertEqual(est.subTypes, [example3])

        db.session.commit()
        db.drop_all()
Ejemplo n.º 4
0
    def test_many_relations3(self):

        db.session.commit()
        db.drop_all()
        db.create_all()

        example3 = MSubtype("gobbo", 2, 2)
        db.session.add(example3)
        db.session.commit()

        exampleSet = MSet('ktk', "Khans of Tarkir", "1", "none", 5, "link",
                          [example3])
        db.session.add(exampleSet)
        db.session.commit()

        example1 = MArtist('Thomas', 5, 5, [exampleSet])
        db.session.add(example1)
        db.session.commit()

        example2 = MArtist('Thom', 5, 5, [exampleSet])
        db.session.add(example2)
        db.session.commit()

        est = db.session.query(MSet).filter_by(code="ktk").first()
        self.assertEqual(len(est.xartists.all()), 2)

        db.session.commit()
        db.drop_all()
Ejemplo n.º 5
0
    def test_many_relations(self):

        db.session.commit()
        db.drop_all()
        db.create_all()

        example3 = MSubtype("gobbo", 2, 2)
        db.session.add(example3)
        db.session.commit()

        exampleSet = MSet('ktk', "Khans of Tarkir", "1", "none", 5, "link",
                          [example3])
        db.session.add(exampleSet)
        db.session.commit()

        example1 = MCard("123", "name", "Creature", [example3], "flying",
                         'LEA', 5, "Red", "1", "1", "url", "common", "thomas")
        db.session.add(example1)
        db.session.commit()

        example2 = MCard("124", "weewoocardnumber2", "Creature", [example3],
                         "flying", 'ktk', 5, "Red", "1", "1", "url", "common",
                         "thomas")
        db.session.add(example2)
        db.session.commit()

        est = db.session.query(MSubtype).filter_by(name="gobbo").first()
        self.assertEqual(len(est.xcards.all()), 2)

        db.session.commit()
        db.drop_all()
Ejemplo n.º 6
0
    def test_set_3(self):
        db.session.commit()
        db.drop_all()
        db.create_all()

        example3 = MSubtype("gobbo", 2, 2)
        db.session.add(example3)
        db.session.commit()

        exampleSet = MSet('LEA', "Limited Edition Alpha", "1", "none", 5,
                          "link", [example3])
        db.session.add(exampleSet)
        db.session.commit()

        est = db.session.query(MSet).filter_by(code="LEA").first()
        self.assertEqual(est.name, "Limited Edition Alpha")
        db.session.commit()
        db.drop_all()
Ejemplo n.º 7
0
    def test_set_2(self):
        db.session.commit()
        db.drop_all()
        db.create_all()

        example3 = MSubtype("gobbo", 2, 2)
        db.session.add(example3)
        db.session.commit()

        exampleSet = MSet('KLD', "Kaladesh", "1", "none", 5, "link",
                          [example3])
        db.session.add(exampleSet)
        db.session.commit()

        est = db.session.query(MSet).filter_by(code="KLD").first()
        self.assertEqual(est.name, 'Kaladesh')
        db.session.commit()
        db.drop_all()
Ejemplo n.º 8
0
    def test_set_1(self):
        db.session.commit()
        db.drop_all()
        db.create_all()

        example3 = MSubtype("gobbo", 2, 2)
        db.session.add(example3)
        db.session.commit()

        exampleSet = MSet('MM3', "Modern Masters 2017 Edition", "1", "none", 5,
                          "link", [example3])
        db.session.add(exampleSet)
        db.session.commit()

        est = db.session.query(MSet).filter_by(code="MM3").first()
        self.assertEqual(est.code, 'MM3')
        db.session.commit()
        db.drop_all()