Beispiel #1
0
 def test_add_for_non_existant_file(self):
   os.chdir(self.root_temp_dir + '/one')
   temp_file_name = 'temp_touch.file'
   try:
     add.add(temp_file_name)
   except SystemExit as e:
     assert e.code == 43
Beispiel #2
0
  def test_add_for_non_existing_pygit_repo(self):
    os.chdir(self.root_temp_dir + '/zero')

    # Not using utime.
    temp_file_name = 'temp_touch.file'
    f = open('temp_touch.file', 'a')
    f.close()

    try:
      add.add(temp_file_name)
    except SystemExit as e:
      assert e.code == 41
Beispiel #3
0
  def test_add_happy_state(self):
    os.chdir(self.root_temp_dir + '/one')
    os.chdir('.pygit')

    index_set = utils.read_object_from_file(globalVars.index_file_name)
    assert len(index_set) == 0

    os.chdir('../')
    f = open('temp_touch.file', 'a')
    f.close()
    temp_file_name = 'temp_touch.file'
    add.add(temp_file_name)

    os.chdir('.pygit')
    index_set = utils.read_object_from_file(globalVars.index_file_name)

    assert len(index_set) == 1
    assert temp_file_name in index_set