Exemple #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')
Exemple #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')
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #7
0
 def tearDown(self):
   cursor.execute('drop table git_users;')
   cursor.execute('drop table git_repos;')
   cursor.execute('drop table git_commits;')
Exemple #8
0
 def tearDown(self):
     cursor.execute('drop table git_users;')
     cursor.execute('drop table git_repos;')
     cursor.execute('drop table git_commits;')