~ken-vandine/gwibber/lp_949395

« back to all changes in this revision

Viewing changes to tests/vala/test-utils.vala

  • Committer: Ken VanDine
  • Date: 2012-03-14 20:58:13 UTC
  • mfrom: (1311.2.1 fix-845374)
  • Revision ID: ken.vandine@canonical.com-20120314205813-n23i7t9xh7rjmcmm
Use the SHA1 hash of the avatar URL instead of simply stripping the slashes, to avoid the resulting filename being too long to be created on ecryptfs volumes.  Thanks James Tait (LP: #845374)

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
      var utils = new Gwibber.Utils ();
99
99
      string url = "http://test.com/avatar";
100
100
      string avatar_path = utils.avatar_path (url);
101
 
      assert (avatar_path == Path.build_path (Path.DIR_SEPARATOR_S, Environment.get_user_cache_dir(), "gwibber/avatars", url.replace ("/","")));
 
101
      assert (avatar_path == Path.build_path (Path.DIR_SEPARATOR_S, Environment.get_user_cache_dir(), "gwibber/avatars", GLib.Checksum.compute_for_string(GLib.ChecksumType.SHA1, url)));
 
102
      url = "http://test.com/this_is_a_very_long_avatar_url_that_should_cause_test_failures_as_per_bug_845374_which_is_scheduled_to_be_fixed_in_a_later_release_but_hopefully_will_be_patched_before_then";
 
103
      stdout.printf(GLib.Checksum.compute_for_string(GLib.ChecksumType.SHA1, url, url.length));
 
104
      avatar_path = utils.avatar_path (url);
 
105
      assert (avatar_path == Path.build_path (Path.DIR_SEPARATOR_S, Environment.get_user_cache_dir(), "gwibber/avatars", GLib.Checksum.compute_for_string(GLib.ChecksumType.SHA1, url)));
102
106
    }
103
107
  }
104
108
}