def test__generate_uploads(self):
        uploads = zpm._generate_uploads(self.conn, self.target,
                                        self.zapp_path, self.auth_opts)
        uploads = list(uploads)

        foojs_tmpl = jinja2.Template(self.foojstmpl_contents.decode())
        foojs = foojs_tmpl.render(auth_opts=self.auth_opts)

        expected_uploads = [
            ('%s/zapp.yaml' % self.target, gzip.open(self.zapp_path).read(),
             'application/x-tar'),
            ('%s/boot/system.map' % self.target,
             self.job_json_prepped.decode('utf-8'),
             'application/json'),
            ('%s/foo.js' % self.target, foojs, None),
            ('%s/index.html' % self.target, self.indexhtml_contents, None),
        ]
        assert uploads[0] == expected_uploads[0]
        assert uploads[1][0] == expected_uploads[1][0]
        assert json.loads(uploads[1][1]) == json.loads(expected_uploads[1][1])
        assert uploads[2] == expected_uploads[2]
        assert uploads[3] == expected_uploads[3]