示例#1
0
 def testUpdateUserLocationData(self):
   cursor.execute("insert into git_users(id,login) values('1','testUser');")
   user_with_location = {'id':1, 'location':'Chennai, India'}
   users = cursor.execute("select * from git_users;")
   users= users.fetchall()
   self.assertTrue(users[0]['location'] is None)
   update_user_location_data(user_with_location)
   users = cursor.execute("select * from git_users;")
   users= users.fetchall()
   self.assertTrue(users[0]['location'] == 'Chennai, India')
示例#2
0
 def testUpdateUserLocationData(self):
     cursor.execute(
         "insert into git_users(id,login) values('1','testUser');")
     user_with_location = {'id': 1, 'location': 'Chennai, India'}
     users = cursor.execute("select * from git_users;")
     users = users.fetchall()
     self.assertTrue(users[0]['location'] is None)
     update_user_location_data(user_with_location)
     users = cursor.execute("select * from git_users;")
     users = users.fetchall()
     self.assertTrue(users[0]['location'] == 'Chennai, India')
示例#3
0
  def testLoadReposData(self):

    repos = [{'id':1, 
              'name':'testRepo',
              'owner':{'id':1,'login':'******'}
              }]
    load_repos_data(repos)
    test_repo = cursor.execute('select * from git_repos where id=1;').fetchall()
    self.assertTrue(len(test_repo) is 1)
    self.assertTrue(test_repo[0]['name']=='testRepo')
    load_repos_data(repos)
    test_repo = cursor.execute('select * from git_repos where id=1;').fetchall()
    self.assertTrue(len(test_repo) is 1)
示例#4
0
 def testInitDB(self):
   tables = cursor.execute('select name from sqlite_master where type="table";')
   tables = tables.fetchall()
   tables = map(lambda x: x[0], tables)
   self.assertIn('git_users', tables)
   self.assertIn('git_repos', tables)
   self.assertIn('git_commits', tables)
示例#5
0
 def testInitDB(self):
     tables = cursor.execute(
         'select name from sqlite_master where type="table";')
     tables = tables.fetchall()
     tables = map(lambda x: x[0], tables)
     self.assertIn('git_users', tables)
     self.assertIn('git_repos', tables)
     self.assertIn('git_commits', tables)
示例#6
0
    def testLoadReposData(self):

        repos = [{
            'id': 1,
            'name': 'testRepo',
            'owner': {
                'id': 1,
                'login': '******'
            }
        }]
        load_repos_data(repos)
        test_repo = cursor.execute(
            'select * from git_repos where id=1;').fetchall()
        self.assertTrue(len(test_repo) is 1)
        self.assertTrue(test_repo[0]['name'] == 'testRepo')
        load_repos_data(repos)
        test_repo = cursor.execute(
            'select * from git_repos where id=1;').fetchall()
        self.assertTrue(len(test_repo) is 1)
示例#7
0
 def tearDown(self):
   cursor.execute('drop table git_users;')
   cursor.execute('drop table git_repos;')
   cursor.execute('drop table git_commits;')
示例#8
0
 def tearDown(self):
     cursor.execute('drop table git_users;')
     cursor.execute('drop table git_repos;')
     cursor.execute('drop table git_commits;')