|  | @@ -16,12 +16,12 @@ var usernames = fs.readFileSync('test/usernames.txt').toString().split("\n");
 | 
	
		
			
				|  |  |  var uuid = uuids[Math.round(Math.random() * (uuids.length - 1))];
 | 
	
		
			
				|  |  |  var username = usernames[Math.round(Math.random() * (usernames.length - 1))];
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -describe('UUID/username', function() {
 | 
	
		
			
				|  |  | +describe('Crafatar', function() {
 | 
	
		
			
				|  |  |    before(function() {
 | 
	
		
			
				|  |  |      cache.get_redis().flushall();
 | 
	
		
			
				|  |  |    });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  describe('UUID', function() {
 | 
	
		
			
				|  |  | +  describe('UUID/username', function() {
 | 
	
		
			
				|  |  |      it("should be an invalid uuid", function(done) {
 | 
	
		
			
				|  |  |        assert.strictEqual(helpers.uuid_valid("g098cb60fa8e427cb299793cbd302c9a"), false);
 | 
	
		
			
				|  |  |        done();
 | 
	
	
		
			
				|  | @@ -58,43 +58,51 @@ describe('UUID/username', function() {
 | 
	
		
			
				|  |  |        assert.strictEqual(helpers.uuid_valid("a"), true);
 | 
	
		
			
				|  |  |        done();
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  | -    it("should not exist", function(done) {
 | 
	
		
			
				|  |  | -      networking.get_profile("00000000000000000000000000000000", function(err, profile) {
 | 
	
		
			
				|  |  | +    it("should not exist (uuid)", function(done) {
 | 
	
		
			
				|  |  | +      networking.get_skin_url("00000000000000000000000000000000", function(err, profile) {
 | 
	
		
			
				|  |  | +        assert.strictEqual(err, 0);
 | 
	
		
			
				|  |  | +        done();
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  | +    });
 | 
	
		
			
				|  |  | +    it("should not exist (username)", function(done) {
 | 
	
		
			
				|  |  | +      networking.get_skin_url("Steve", function(err, profile) {
 | 
	
		
			
				|  |  |          assert.strictEqual(err, 0);
 | 
	
		
			
				|  |  |          done();
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |    });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  describe('Avatar', function() {
 | 
	
		
			
				|  |  | +  describe('Networking: Avatar', function() {
 | 
	
		
			
				|  |  |      it("should be downloaded (uuid)", function(done) {
 | 
	
		
			
				|  |  |        helpers.get_avatar(uuid, false, 160, function(err, status, image) {
 | 
	
		
			
				|  |  |          assert.strictEqual(status, 2);
 | 
	
		
			
				|  |  |          done();
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  | -    it("should be local (uuid)", function(done) {
 | 
	
		
			
				|  |  | +    it("should be cached (uuid)", function(done) {
 | 
	
		
			
				|  |  |        helpers.get_avatar(uuid, false, 160, function(err, status, image) {
 | 
	
		
			
				|  |  |          assert.strictEqual(status, 1);
 | 
	
		
			
				|  |  |          done();
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  | +    /* We can't test this because of mojang's rate limits :(
 | 
	
		
			
				|  |  |      it("should be checked (uuid)", function(done) {
 | 
	
		
			
				|  |  |        var original_cache_time = config.local_cache_time;
 | 
	
		
			
				|  |  |        config.local_cache_time = 0;
 | 
	
		
			
				|  |  |        helpers.get_avatar(uuid, false, 160, function(err, status, image) {
 | 
	
		
			
				|  |  | -        assert.strictEqual(status, 2);
 | 
	
		
			
				|  |  | +        assert.strictEqual(status, 3);
 | 
	
		
			
				|  |  |          config.local_cache_time = original_cache_time;
 | 
	
		
			
				|  |  |          done();
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  | +    */
 | 
	
		
			
				|  |  |      it("should be downloaded (username)", function(done) {
 | 
	
		
			
				|  |  |        helpers.get_avatar(username, false, 160, function(err, status, image) {
 | 
	
		
			
				|  |  |          assert.strictEqual(status, 2);
 | 
	
		
			
				|  |  |          done();
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  | -    it("should be local (username)", function(done) {
 | 
	
		
			
				|  |  | +    it("should be cached (username)", function(done) {
 | 
	
		
			
				|  |  |        helpers.get_avatar(username, false, 160, function(err, status, image) {
 | 
	
		
			
				|  |  |          assert.strictEqual(status, 1);
 | 
	
		
			
				|  |  |          done();
 | 
	
	
		
			
				|  | @@ -104,7 +112,7 @@ describe('UUID/username', function() {
 | 
	
		
			
				|  |  |        var original_cache_time = config.local_cache_time;
 | 
	
		
			
				|  |  |        config.local_cache_time = 0;
 | 
	
		
			
				|  |  |        helpers.get_avatar(username, false, 160, function(err, status, image) {
 | 
	
		
			
				|  |  | -        assert.strictEqual(status, 2);
 | 
	
		
			
				|  |  | +        assert.strictEqual(status, 3);
 | 
	
		
			
				|  |  |          config.local_cache_time = original_cache_time;
 | 
	
		
			
				|  |  |          done();
 | 
	
		
			
				|  |  |        });
 | 
	
	
		
			
				|  | @@ -137,18 +145,20 @@ describe('UUID/username', function() {
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |      it("should time out on profile download", function(done) {
 | 
	
		
			
				|  |  | +      var original_timeout = config.http_timeout;
 | 
	
		
			
				|  |  |        config.http_timeout = 1;
 | 
	
		
			
				|  |  | -      networking.get_profile("069a79f444e94726a5befca90e38aaf5", function(err, profile) {
 | 
	
		
			
				|  |  | +      networking.get_skin_url("069a79f444e94726a5befca90e38aaf5", function(err, profile) {
 | 
	
		
			
				|  |  |          assert.strictEqual(err.code, "ETIMEDOUT");
 | 
	
		
			
				|  |  | -        config.http_timeout = 3000;
 | 
	
		
			
				|  |  | +        config.http_timeout = original_timeout;
 | 
	
		
			
				|  |  |          done();
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  |      it("should time out on skin download", function(done) {
 | 
	
		
			
				|  |  | +      var original_timeout = config.http_timeout;
 | 
	
		
			
				|  |  |        config.http_timeout = 1;
 | 
	
		
			
				|  |  |        networking.skin_file("http://textures.minecraft.net/texture/477be35554684c28bdeee4cf11c591d3c88afb77e0b98da893fd7bc318c65184", "face.png", "helm.png", function(err) {
 | 
	
		
			
				|  |  |          assert.strictEqual(err.code, "ETIMEDOUT");
 | 
	
		
			
				|  |  | -        config.http_timeout = 3000;
 | 
	
		
			
				|  |  | +        config.http_timeout = original_timeout;
 | 
	
		
			
				|  |  |          done();
 | 
	
		
			
				|  |  |        });
 | 
	
		
			
				|  |  |      });
 |