Ejemplo n.º 1
0
    def test_purge(self):
 
      delete_from_directory_by_hashes(CACHE_DIRECTORY, '*')
      delete_from_directory_by_hashes(EV_DIRECTORY, '*')
      delete_from_directory_by_hashes(SEED_DIRECTORY, '*')

      all_hashes = read_all()
      assert len(all_hashes['evs']) == 0
      assert len(all_hashes['cache']) == 0
      assert len(all_hashes['seeds']) == 0

      with open(LOG_FILEPATH, 'w+') as fp:
          pass

      expected_value.is_equal_to(find_foo(1))
      expected_value.is_equal_to(find_biz(1))
      expected_value.is_equal_to(find_baz(1))
      expected_value.is_equal_to(find_bar(1))

      spam = read_all()
      assert len(spam['evs']) != 0
      assert len(spam['cache']) != 0
      assert len(spam['seeds']) != 0
      
      with open(LOG_FILEPATH, 'w+') as fp:
          pass

      expected_value.is_equal_to(find_foo(1))
      expected_value.is_equal_to(find_biz(1))
      expected_value.is_equal_to(find_baz(1))
      expected_value.is_equal_to(find_bar(1))

      spam_and_ham = read_all() 
      purge() 
      ham = read_all()

      for kind, hashes in ham.items():
          for h in hashes:
              assert h not in spam[kind]

      for kind, hashes in spam.items():
          for h in hashes:
              assert h not in ham[kind]

      for kind, hashes in spam_and_ham.items():
          for h in hashes:
              assert h in spam[kind] or h in ham[kind]
Ejemplo n.º 2
0
 def test_multiple_expected_value_calls(self):
     assert expected_value.is_equal_to(2)
     assert expected_value.is_equal_to(3)
     assert expected_value.is_equal_to(4)
Ejemplo n.º 3
0
 def test_expected_value_prompt(self):
     assert expected_value.is_equal_to(2) 
Ejemplo n.º 4
0
    def test_purge(self):
 
      delete_from_directory_by_hashes('cache', '*')
      delete_from_directory_by_hashes('evs', '*')
      delete_from_directory_by_hashes('seeds', '*')

      all_hashes = read_all()
      assert len(all_hashes['evs']) == 0
      assert len(all_hashes['cache']) == 0
      assert len(all_hashes['seeds']) == 0

      with open(LOG_FILEPATH, 'w+') as fp:
          pass

      expected_value.is_equal_to(find_foo(1))
      expected_value.is_equal_to(find_biz(1))
      expected_value.is_equal_to(find_baz(1))
      expected_value.is_equal_to(find_bar(1))

      spam = read_all()
      assert len(spam['evs']) != 0
      assert len(spam['cache']) != 0
      assert len(spam['seeds']) != 0
      
      with open(LOG_FILEPATH, 'w+') as fp:
          pass

      expected_value.is_equal_to(find_foo(1))
      expected_value.is_equal_to(find_biz(1))
      expected_value.is_equal_to(find_baz(1))
      expected_value.is_equal_to(find_bar(1))

      spam_and_ham = read_all() 
      purge() 
      ham = read_all()

      for kind, hashes in ham.items():
          for h in hashes:
              assert h not in spam[kind]

      for kind, hashes in spam.items():
          for h in hashes:
              assert h not in ham[kind]

      for kind, hashes in spam_and_ham.items():
          for h in hashes:
              assert h in spam[kind] or h in ham[kind]
Ejemplo n.º 5
0
 def test_multiple_expected_value_calls(self):
     assert expected_value.is_equal_to(2)
     assert expected_value.is_equal_to(3)
     assert expected_value.is_equal_to(4)
Ejemplo n.º 6
0
 def test_expected_value_prompt(self):
     assert expected_value.is_equal_to(2)