Exemple #1
0
    def testRequestLoan(self):

        requests = LoanRequest.objects.all()
        self.assertEqual(len(requests), 0)

        # Creating a LoanRequest
        reason, amount, loanTime = "mortgage", 10000, 2
        request = LoanRequest(reason=reason, amount=amount, loanTime=loanTime, user=self.testuser1)
        request.save()

        requests = LoanRequest.objects.all()

        self.assertEqual(len(requests), 1)
        self.assertEqual(len(self.testuser1.loanrequest_set.all()), 1)
Exemple #2
0
    def testRequestLoan(self):

        requests = LoanRequest.objects.all()
        self.assertEqual(len(requests), 0)

        # Creating a LoanRequest
        reason, amount, loanTime = "mortgage", 10000, 2
        request = LoanRequest(reason=reason,
                              amount=amount,
                              loanTime=loanTime,
                              user=self.testuser1)
        request.save()

        requests = LoanRequest.objects.all()

        self.assertEqual(len(requests), 1)
        self.assertEqual(len(self.testuser1.loanrequest_set.all()), 1)
from django.contrib.auth.models import User
from growthstreet.models import UserDetails,LoanRequest

users = User.objects.all()
usernames = [['naman','*****@*****.**'],
             ['jainy','*****@*****.**'],
             ['namu','*****@*****.**'],
             ]

counter = 0
for i, email in usernames:
    a = User.objects.create_user(username=i, password=i, email=email)
    a.is_active = True
    if i == 'jainy': # jainy is the superuser
        a.is_staff = True
        a.is_superuser = True
    a.save()

    request = LoanRequest(reason = "broke%s" %counter , amount = 10000+counter, loanTime=1+counter, user = a)
    request.save()
    counter += 3


# database querying
conn = sqlite3.connect('db.sqlite3')
c = conn.cursor()
c.execute("select * from auth_user")
results = c.fetchall()
print results