Exemplo n.º 1
0
    def test_userdb_modify_details(self):
        """
        Test if we can add more user details to db
        """
        user = User(eth_address="0x0E35462535daE6fd521f0Eea67dc4e9485C714dC")
        db.session.add(user)
        db.session.commit()

        old_id = user.id

        user.username = "******"
        user.email = "test"
        user.city_country = "test"
        user.tags = "test1, test2"
        user.img_src = "www.testurl.com"
        user.about = "test"

        db.session.commit()

        self.assertTrue(old_id == user.id)
        self.assertTrue(
            "0x0E35462535daE6fd521f0Eea67dc4e9485C714dC" == user.eth_address)
        self.assertTrue("test" == user.username)
        self.assertTrue("test" == user.email)
        self.assertTrue("test" == user.city_country)
        self.assertTrue(["test1", "test2"] == user.tags)
        self.assertTrue("www.testurl.com" == user.img_src)
        self.assertTrue("test" == user.about)
        self.assertTrue(user.active)
Exemplo n.º 2
0
def seed_db():
    """
    Seeds the database with some initial data
    """
    user1 = User(
        eth_address='0x0d604C28A2a7c199c7705859c3f88A71cCE2aCb7'.lower())
    user1.username = "******"
    user1.email = "*****@*****.**"
    user1.city_country = "Singapore, SG"
    user1.tags = "Meeting Spaces"
    user1.about = '''This is the best meeting space you will ever see'''
    user1.seller_detail = '''We sell space'''
    user1.buyer_detail = '''We are not buying'''

    user2 = User(
        eth_address='0xF4675187bD8B058CcF87f7116b54970fC3f81b52'.lower())
    user2.username = "******"
    user2.email = "*****@*****.**"
    user2.city_country = "Singapore, SG"
    user2.tags = "Stylist"
    user2.about = '''Reimagine your looks with us'''
    user2.seller_detail = '''We are serving looks tonight'''
    user2.buyer_detail = '''We are not buying'''

    user3 = User(
        eth_address='0x4FaE992a476bB00Be85B7BF76fef8e27DE2231C7'.lower())
    user3.username = "******"
    user3.email = "*****@*****.**"
    user3.city_country = "Singapore, SG"
    user3.tags = "Buffet"
    user3.about = '''Eat till you get a heart attack'''
    user3.seller_detail = '''We sell food'''
    user3.buyer_detail = '''We are not buying'''

    user4 = User(
        eth_address='0x6ea57F562Ef39f1776eb66D91c54A961Fa6DdadA'.lower())
    user4.username = "******"
    user4.email = "*****@*****.**"
    user4.city_country = "Singapore, SG"
    user4.tags = "Photography"
    user4.about = ('We are a group of photographers specialized in wedding'
                   'photography. '
                   'We have won numerous awards for our photos. '
                   'We will capture your '
                   'memories in ways you cannot imagine.')
    user4.seller_detail = '''We sell photos'''
    user4.buyer_detail = '''We are not buying'''

    user5 = User(
        eth_address='0x04Ee2da68b909684d586a852970E424981f30928'.lower())
    user5.username = "******"
    user5.email = "*****@*****.**"
    user5.city_country = "Singapore, SG"
    user5.tags = "Bar, Restaurant"
    user5.about = ('Award winnning winebar with the best selection of alcohol.'
                   'We serve delicious international cuisine, with fusion'
                   'dishes inspired from our travels. We are always ready for'
                   'your craziest events.')
    user5.seller_detail = '''We sell wine'''
    user5.buyer_detail = '''We are not buying'''

    user6 = User(
        eth_address='0x50E9002d238d9a2A29C3047971E8006663A9d799'.lower())
    user6.username = "******"
    user6.email = "*****@*****.**"
    user6.city_country = "Singapore, SG"
    user6.tags = "Performer"
    user6.about = ('Dancers who dance are people who like to dance alot.'
                   'Give us music and we will dance for you.')
    user6.seller_detail = '''We sell dance'''
    user6.buyer_detail = '''We are not buying'''

    db.session.add(user1)
    db.session.add(user2)
    db.session.add(user3)
    db.session.add(user4)
    db.session.add(user5)
    db.session.add(user6)

    db.session.commit()