コード例 #1
0
ファイル: test_datauri.py プロジェクト: chrisgeo/comboloader
class TestDataURI(unittest.TestCase):
  def setUp(self):
    self.data_uri = DataURI() 
    file = open(test_file, 'w')
    file.write('Testing some content')
    file.close()
  
  def tearDown(self):
    os.remove(test_file)

  def test_data_uri_from_local_path(self):
    expected = \
      'data:text/plain;charset=utf-8;base64,VGVzdGluZyBzb21lIGNvbnRlbnQ='
    result = self.data_uri.encode(test_file)
    assert result == expected

  def test_data_uri_from_url(self):
    pass

  @raises(Exception)
  def test_data_uri_file_not_exist(self):
    self.data_uri.encode('somefile.png')
コード例 #2
0
ファイル: test_datauri.py プロジェクト: chrisgeo/comboloader
 def setUp(self):
   self.data_uri = DataURI() 
   file = open(test_file, 'w')
   file.write('Testing some content')
   file.close()