impossiblefxv1 1.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/HOWTO-PUBLISH.txt +15 -0
  2. package/README.md +21 -0
  3. package/apis/edit-2016-06-02.json +15 -0
  4. package/apis/metadata.json +31 -0
  5. package/apis/project-2016-06-01.json +56 -0
  6. package/apis/project-2016-06-02.json +767 -0
  7. package/apis/project-2023-03-07.json +767 -0
  8. package/apis/project-2023-12-11.json +767 -0
  9. package/apis/render-2016-06-02.json +764 -0
  10. package/apis/render-2023-12-11.json +764 -0
  11. package/dist/fx-sdk-latest.js +22494 -0
  12. package/dist-tools/build-browser.js +109 -0
  13. package/dist-tools/build-sdk.sh +6 -0
  14. package/dist-tools/es6-promise.js +957 -0
  15. package/dist-tools/foo.sh +4 -0
  16. package/dist-tools/publish.sh +6 -0
  17. package/lib/browser.js +58 -0
  18. package/lib/config.js +125 -0
  19. package/lib/core.js +15 -0
  20. package/lib/credentials/chain.js +54 -0
  21. package/lib/credentials/environment.js +69 -0
  22. package/lib/credentials/inifile.js +57 -0
  23. package/lib/credentials/token.js +38 -0
  24. package/lib/credentials.js +53 -0
  25. package/lib/encoding.js +36 -0
  26. package/lib/endpoint.js +18 -0
  27. package/lib/fx.js +50 -0
  28. package/lib/http/node.js +69 -0
  29. package/lib/http/xhr.js +12 -0
  30. package/lib/http.js +57 -0
  31. package/lib/proto.js +38 -0
  32. package/lib/protocol.js +56 -0
  33. package/lib/request.js +252 -0
  34. package/lib/response.js +24 -0
  35. package/lib/service.js +182 -0
  36. package/lib/services/batch.js +5 -0
  37. package/lib/services/edit.js +9 -0
  38. package/lib/services/project.js +102 -0
  39. package/lib/services/render.js +63 -0
  40. package/lib/services/story.js +5 -0
  41. package/lib/services.js +30 -0
  42. package/lib/util.js +126 -0
  43. package/package.json +37 -0
  44. package/package.json.save +36 -0
  45. package/proto/Movie.proto +4081 -0
  46. package/proto/fx.proto +43 -0
  47. package/templates/config.html +91 -0
  48. package/templates/examples.html +69 -0
  49. package/templates/getstarted.html +30 -0
  50. package/templates/index.html +6 -0
  51. package/templates/makeexample.py +57 -0
  52. package/templates/makerequests.html +210 -0
  53. package/templates/operation.html +36 -0
  54. package/templates/service.html +9 -0
  55. package/templates/services.html +19 -0
  56. package/templates/version.html +12 -0
  57. package/templates/versions.html +10 -0
  58. package/templates/workservice.html +68 -0
  59. package/test/circles.mp4 +0 -0
  60. package/test/config.js +131 -0
  61. package/test/index.html +35 -0
  62. package/test/mocha.opts +4 -0
  63. package/test/project.js +148 -0
  64. package/test/render.js +136 -0
  65. package/test/retry.js +53 -0
  66. package/test/sdktests.js +62 -0
  67. package/test/sdl.js +125 -0
  68. package/test/servertest/simple.js +20 -0
package/test/config.js ADDED
@@ -0,0 +1,131 @@
1
+ if(typeof window === 'undefined') {
2
+ assert = require('chai').assert;
3
+ FX = require('../lib/fx')
4
+ } else {
5
+ assert = chai.assert
6
+ }
7
+
8
+ describe('Config Tests', function() {
9
+ describe('Config Update api', function() {
10
+ it('should update config with credentials', function() {
11
+ FX.config.update({apikey: 'apikey', apisecret: 'apisecret'})
12
+ assert.equal(FX.config.apikey, 'apikey')
13
+ assert.equal(FX.config.apisecret, 'apisecret')
14
+ })
15
+ })
16
+
17
+ describe('Config Update Region', function() {
18
+ it('should update config with region', function() {
19
+ FX.config.update({region: 'us-west-2'})
20
+ assert.equal(FX.config.region, 'us-west-2')
21
+ })
22
+ })
23
+
24
+ describe('Config Set Domain Suffix in service', function() {
25
+ it('should update config with domainSuffix', function() {
26
+ const domainSuffix = ".onpremise.impossible.io";
27
+
28
+ var prj = new FX.Project({domainSuffix: domainSuffix});
29
+ var render = new FX.Render({domainSuffix: domainSuffix});
30
+ //console.log("prj", prj.config.endpoint);
31
+ //console.log("render", render.config.endpoint);
32
+ assert.isTrue(prj.config.endpoint && prj.config.endpoint.endsWith(domainSuffix))
33
+ assert.isTrue(render.config.endpoint && render.config.endpoint.endsWith(domainSuffix))
34
+ })
35
+ })
36
+
37
+ describe('Config apiVersions Equal', function() {
38
+ it('should load exact api Version', function() {
39
+ /* does not work, gets overriden by "latest" default value in config.apiVersion
40
+ FX.config.apiVersions = {
41
+ project: '2016-06-02',
42
+ render: '2016-06-02'
43
+ }*/
44
+
45
+ var prj = new FX.Project({apiVersion: '2016-06-02'}),
46
+ render = new FX.Render({apiVersion: '2016-06-02'});
47
+
48
+ assert.equal(prj.apiVersion, '2016-06-02')
49
+ assert.equal(render.apiVersion, '2016-06-02')
50
+ })
51
+ })
52
+
53
+ describe('Config apiVersions Fuzzy', function() {
54
+ it('should load best match api Version', function() {
55
+ assert.throws(function() {
56
+ var prj = new FX.Project({apiVersion: '2012-06-01'})
57
+ })
58
+
59
+ var prj = new FX.Project({apiVersion: '2020-12-31'})
60
+ assert.operator(prj.apiVersion, '>=', '2016-06-02')
61
+ })
62
+ })
63
+
64
+
65
+ describe('Bound Parameter', function() {
66
+ this.timeout(30000);
67
+ this.slow(5000);
68
+
69
+ it('should have project and movie set', function(done) {
70
+ var myMovie = new FX.Render({
71
+ region: 'eu-west-1',
72
+ params: {
73
+ ProjectId: '0288cda5-b30e-4ba2-94cb-03fd9662ed57',
74
+ Movie: "mymovie"
75
+ }
76
+ });
77
+
78
+ myMovie.renderToS3({
79
+ Params:{
80
+ mytext: "Yuhu"
81
+ },
82
+ Bucket: "is-exchange",
83
+ Filename: "/test/jstesassert.mp4",
84
+ Format: "mp4",
85
+ UsePolicy: true
86
+ }, function(err, data){
87
+ assert.isNull(err)
88
+ assert.match(data.Token, /[A-Za-z0-9\-\:]*/)
89
+ assert.equal(data.Upload.Status, 200)
90
+ done()
91
+ })
92
+
93
+ })
94
+ })
95
+
96
+
97
+ describe('Bound Parameter Override', function() {
98
+ this.timeout(30000);
99
+ this.slow(5000);
100
+
101
+ it('should have project and movie set', function(done) {
102
+ var myMovie = new FX.Render({
103
+ region: 'eu-west-1',
104
+ params: {
105
+ ProjectId: 'will be overriden',
106
+ Movie: "mymovie"
107
+ }
108
+ });
109
+
110
+ myMovie.renderToS3({
111
+ ProjectId: '0288cda5-b30e-4ba2-94cb-03fd9662ed57',
112
+ Params:{
113
+ mytext: "Yuhu"
114
+ },
115
+ Bucket: "is-exchange",
116
+ Filename: "/test/jstesassert.mp4",
117
+ Format: "mp4",
118
+ UsePolicy: true
119
+ }, function(err, data){
120
+ assert.isNull(err)
121
+ assert.match(data.Token, /[A-Za-z0-9\-\:]*/)
122
+ assert.equal(data.Upload.Status, 200)
123
+ done()
124
+ })
125
+
126
+ })
127
+ })
128
+ })
129
+
130
+
131
+
@@ -0,0 +1,35 @@
1
+
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Mocha Tests</title>
6
+ <link href="/node_modules/mocha/mocha.css" rel="stylesheet" />
7
+ </head>
8
+ <body>
9
+ <div id="mocha"></div>
10
+
11
+ <!--<script src="https://cdn.rawgit.com/jquery/jquery/2.1.4/dist/jquery.min.js"></script>-->
12
+ <!--<script src="https://cdn.rawgit.com/Automattic/expect.js/0.3.1/index.js"></script>-->
13
+ <script src="/node_modules/mocha/mocha.js"></script>
14
+ <script src="/node_modules/chai/chai.js"></script>
15
+ <script src="/dist/fx-sdk-latest.js"></script>
16
+
17
+ <script>mocha.setup('bdd')</script>
18
+ <script src="/test/config.js"></script>
19
+ <script src="/test/render.js"></script>
20
+
21
+ <!-- These test require auth! -->
22
+ <script src="/test/sdktests.js"></script>
23
+ <script src="/test/project.js"></script>
24
+ <script src="/test/sdl.js"></script>
25
+
26
+ <!-- Does not work in browser due to "nock" mocking interceptor -->
27
+ <!--<script src="/test/retry.js"></script>-->
28
+
29
+ <script>
30
+ // mocha.checkLeaks();
31
+ // mocha.globals(['jQuery']);
32
+ mocha.run();
33
+ </script>
34
+ </body>
35
+ </html>
@@ -0,0 +1,4 @@
1
+ --require should
2
+ --reporter spec
3
+ --ui bdd
4
+ --recursive
@@ -0,0 +1,148 @@
1
+ if(typeof window === 'undefined') {
2
+ assert = require('chai').assert;
3
+ FX = require('../lib/fx')
4
+ } else {
5
+ assert = chai.assert
6
+ }
7
+
8
+
9
+ var sdl = new FX.SDL()
10
+ var prj = new FX.Project({
11
+ apiVersion: '2016-06-02',
12
+ region: 'us-west-2',
13
+ params: {
14
+ ProjectId: 'e954a307-6d14-48c3-97c6-23bba0c0af77',
15
+ }
16
+ })
17
+
18
+
19
+ describe('Project API Tests', function() {
20
+ this.timeout(30000);
21
+ this.slow(5000);
22
+
23
+ var prjuid = null
24
+ it("Create Project", function(done){
25
+ prj.createProject({Name: 'TestApi001'}, function(err, data){
26
+ assert.isNull(err)
27
+ assert.equal(data.Project.Name, "TestApi001")
28
+ prjuid = data.Project.ProjectId
29
+ console.log("Project: ", prjuid);
30
+ done()
31
+ })
32
+ })
33
+
34
+ it("List Projects", function(done){
35
+ prj.listProjects(function(err, data) {
36
+ assert.isNull(err)
37
+ assert.operator(data.Projects.length, '>=', 1)
38
+ done()
39
+ })
40
+ })
41
+
42
+ if(!FX.util.isBrowser) {
43
+ var fs = require('fs')
44
+
45
+ it("Upload Asset", function(done){
46
+ prj.uploadAsset({
47
+ ProjectId: prjuid,
48
+ Name: "circles.mp4",
49
+ Data: fs.createReadStream('test/circles.mp4')
50
+ }, function(err, data) {
51
+ assert.isNull(err)
52
+ done()
53
+ })
54
+ })
55
+ }
56
+
57
+ it("List Assets", function(done){
58
+ prj.listAssets({ProjectId: prjuid}, function(err, data) {
59
+ assert.isNull(err)
60
+ assert.typeOf(data.All, 'object')
61
+
62
+ if(!FX.util.isBrowser)
63
+ assert.operator(data.Videos.length, '>', 0)
64
+
65
+ done()
66
+ })
67
+ })
68
+
69
+ if(!FX.util.isBrowser) {
70
+ var fs = require('fs')
71
+
72
+ it("Get Asset", function(done){
73
+ var Stream = require('stream').Stream;
74
+
75
+ prj.getAsset({
76
+ ProjectId: prjuid,
77
+ Name: "circles.mp4",
78
+ }, function(err, data) {
79
+ assert.isNull(err)
80
+ assert.instanceOf(data.Data, Stream)
81
+
82
+ var out = fs.createWriteStream('/tmp/foo-bar.mp4')
83
+ var stream = data.Data.pipe(out)
84
+ stream.on('finish', function () {
85
+ var stat = fs.statSync('/tmp/foo-bar.mp4')
86
+ assert.equal(stat.size, 548317)
87
+ done();
88
+ });
89
+ })
90
+ })
91
+ }
92
+
93
+ if(!FX.util.isBrowser) {
94
+ it("Delete Assets", function(done){
95
+ prj.deleteAsset({ProjectId: prjuid, Name: "circles.mp4"}, function(err, data) {
96
+ assert.isNull(err)
97
+ done()
98
+ })
99
+ })
100
+ }
101
+
102
+
103
+ it("Upload App Data", function(done){
104
+ var fs = require('fs')
105
+
106
+ prj.uploadAppData({
107
+ ProjectId: prjuid,
108
+ Name: "mocha",
109
+ Data: fs.createReadStream('test/mocha.opts')
110
+ }, function(err, data) {
111
+ assert.isNull(err)
112
+ done()
113
+ })
114
+ })
115
+
116
+ it("Get App Data", function(done){
117
+ var Stream = require('stream').Stream;
118
+ var fs = require('fs')
119
+
120
+ prj.getAppData({
121
+ ProjectId: prjuid,
122
+ Name: "mocha",
123
+ }, function(err, data) {
124
+ assert.isNull(err)
125
+ assert.instanceOf(data.Data, Stream)
126
+
127
+ var out = fs.createWriteStream('/tmp/mocha.opts')
128
+ var stream = data.Data.pipe(out)
129
+ stream.on('finish', function () {
130
+ var stat = fs.statSync('/tmp/mocha.opts')
131
+ assert.equal(stat.size, 54)
132
+ done();
133
+ });
134
+ })
135
+ })
136
+
137
+
138
+
139
+
140
+ it("Delete Project", function(done){
141
+ prj.deleteProject({ProjectId: prjuid}, function(err, data){
142
+ assert.isNull(err)
143
+ assert.equal(data.Status, 201)
144
+ done()
145
+ })
146
+ })
147
+
148
+ })
package/test/render.js ADDED
@@ -0,0 +1,136 @@
1
+ if(typeof window === 'undefined') {
2
+ assert = require('chai').assert;
3
+ FX = require('../lib/fx')
4
+ } else {
5
+ assert = chai.assert
6
+ }
7
+
8
+ const REGION="eu-west-1";
9
+ //const REGION="eu-west-2";
10
+
11
+ const PRJUID = "0288cda5-b30e-4ba2-94cb-03fd9662ed57";
12
+ //const PRJUID = "215fe9e1-7bf5-4333-87c3-fc485829fb7b";
13
+
14
+ var render = new FX.Render({apiVersion: '2016-06-02', region: REGION})
15
+
16
+ describe('Render Tests', function() {
17
+ this.timeout(30000);
18
+ this.slow(5000);
19
+
20
+
21
+
22
+ describe('Get Token', function() {
23
+ it('should return a render token', function(done) {
24
+ render.getToken({
25
+ ProjectId: PRJUID,
26
+ Params:{mytext: "Yuhu"},
27
+ Movie: "mymovie"
28
+ }, function(err, data){
29
+ console.log(err, data)
30
+ assert.isNull(err)
31
+ assert.typeOf(data.Token, 'string')
32
+ done();
33
+ })
34
+ })
35
+ })
36
+
37
+ describe('Get Token width Parallel & Key', function() {
38
+ it('should return a render token', function(done) {
39
+ render.getToken({
40
+ ProjectId: PRJUID,
41
+ Params:{mytext: "Yuhu"},
42
+ Movie: "mymovie",
43
+ Parallel: 4,
44
+ Routingkey: "default"
45
+ }, function(err, data){
46
+ assert.isNull(err)
47
+ assert.typeOf(data.Token, 'string')
48
+ done();
49
+ })
50
+ })
51
+ })
52
+
53
+ describe('Get Render URL', function() {
54
+ it('should return a render URL', function(done) {
55
+ render.getRenderURL({
56
+ ProjectId: PRJUID,
57
+ Params:{mytext: "Yuhu"},
58
+ Movie: "mymovie",
59
+ Parallel: 2
60
+ }, function(err, data){
61
+ assert.isNull(err)
62
+ assert.match(data.Token, /[A-Za-z0-9\-\:]*/)
63
+ assert.match(data.URL, /http.*/)
64
+ done()
65
+ })
66
+ })
67
+ })
68
+
69
+
70
+ describe('Get Post frame URL', function() {
71
+ it('should return a render URL', function(done) {
72
+ render.getPosterFrameURL({
73
+ ProjectId: PRJUID,
74
+ Params:{mytext: "Yuhu"},
75
+ Movie: "mymovie",
76
+ Frame: 100
77
+ }, function(err, data){
78
+ assert.isNull(err)
79
+ assert.match(data.Token, /[A-Za-z0-9\-\:]*/)
80
+ assert.match(data.URL, /http.*/)
81
+ done()
82
+ })
83
+ })
84
+ })
85
+
86
+ describe('Render To S3', function() {
87
+ it('should return a S3 URL', function(done) {
88
+ render.renderToS3({
89
+ ProjectId: PRJUID,
90
+ Movie: "mymovie",
91
+ Params:{
92
+ mytext: "Yuhu"
93
+ },
94
+ Bucket: "is-exchange",
95
+ Filename: "/test/jstest.mp4",
96
+ Format: "mp4",
97
+ Metadata:{
98
+ "a": "b"
99
+ },
100
+ UsePolicy: true /*
101
+ AccessKeyId: "AKIAI5DPA4IOHUSNG3EQ",
102
+ SecretAccessKey: "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"*/
103
+ }, function(err, data){
104
+ assert.isNull(err)
105
+ assert.match(data.Token, /[A-Za-z0-9\-\:]*/)
106
+ assert.equal(data.Upload.Status, 200)
107
+ done()
108
+ })
109
+ })
110
+ })
111
+
112
+
113
+ // render to facebook fails with unauthenticated user error
114
+ // describe('Render To Facebook', function() {
115
+ // it('should return a positive response', function(done) {
116
+ // render.renderToFacebook({
117
+ // ProjectId: PRJUID,
118
+ // Movie: "mymovie",
119
+ // Params:{
120
+ // mytext: "Yuhu"
121
+ // },
122
+ // Bucket: "is-exchange",
123
+ // Filename: "/test/jstest.mp4",
124
+ // Format: "mp4",
125
+ // Description: "Test Upload",
126
+ // Title: "Another Test Upload",
127
+ // OAuthAccessToken: "EAACEdEose0cBAJPFdxY4OlZB9tS98LcR0qysSGoYSGyv2IMuwjX1VBaJvlNV9XwjQFGwiaUFNZCEpthUHFWGZASoEg5ZA2shwBKjonZBt2HVoa3ZAaZCOWBQyyJKJGpjJi6pj6Xjwa9zr3RGIZBgFi46cEvBqJPe0x4JCPRUjTaddgZDZD",
128
+ // }, function(err, data){
129
+ // assert.isNull(err)
130
+ // assert.match(data.Token, /[A-Za-z0-9\-\:]*/)
131
+ // assert.equal(data.Upload.Status, 200)
132
+ // done()
133
+ // })
134
+ // })
135
+ // })
136
+ })
package/test/retry.js ADDED
@@ -0,0 +1,53 @@
1
+ if(typeof window === 'undefined') {
2
+ assert = require('chai').assert;
3
+ FX = require('../lib/fx')
4
+ } else {
5
+ assert = chai.assert
6
+ }
7
+
8
+ var nock = require('nock')
9
+ var nonexisting = "e954a30f-6d18-49c3-97c6-23bba0c0af77",
10
+ existing = '0288cda5-b30e-4ba2-94cb-03fd9662ed57'
11
+
12
+ var prj = new FX.Project({
13
+ apiVersion: '2016-06-02',
14
+ region: 'eu-west-1',
15
+ maxRetries: 4
16
+ })
17
+
18
+ describe('Retry Tests', function() {
19
+ this.timeout(30000);
20
+ this.slow(5000);
21
+
22
+ /*
23
+
24
+ it('Retry Once', function(done){
25
+ var scope = nock('https://api-eu-west-1.impossible.io', { allowUnmocked: true })
26
+ .get('/v1/list/data/0288cda5-b30e-4ba2-94cb-03fd9662ed57')
27
+ .reply(502)
28
+ .get('/v1/list/data/0288cda5-b30e-4ba2-94cb-03fd9662ed57')
29
+ .reply(404)
30
+
31
+ prj.listAssets({ProjectId: existing}, function(err, data) {
32
+ assert.isNotNull(err)
33
+ assert.equal(err.code, 404)
34
+ done()
35
+ })
36
+ })
37
+
38
+ it('Retry Max', function(done){
39
+ var scope = nock('https://api-eu-west-1.impossible.io', { allowUnmocked: true })
40
+ .get('/v1/list/data/0288cda5-b30e-4ba2-94cb-03fd9662ed57')
41
+ .times(10)
42
+ .reply(502)
43
+ .get('/v1/list/data/0288cda5-b30e-4ba2-94cb-03fd9662ed57')
44
+ .reply(404)
45
+
46
+ prj.listAssets({ProjectId: existing}, function(err, data) {
47
+ assert.isNotNull(err)
48
+ assert.equal(err.code, 502)
49
+ done()
50
+ })
51
+ })
52
+ */
53
+ })
@@ -0,0 +1,62 @@
1
+ if(typeof window === 'undefined') {
2
+ assert = require('chai').assert;
3
+ BLUEBIRD = require('bluebird')
4
+
5
+ FX = require('../lib/fx')
6
+ } else {
7
+ assert = chai.assert
8
+ BLUEBIRD = Promise
9
+ }
10
+
11
+
12
+ var nonexisting = "e954a30f-6d18-49c3-97c6-23bba0c0af77"
13
+ var prj = new FX.Project({
14
+ apiVersion: '2016-06-02',
15
+ region: 'eu-west-1',
16
+ params: {
17
+ ProjectId: 'e954a307-6d14-48c3-97c6-23bba0c0af77',
18
+ }
19
+ })
20
+
21
+
22
+ describe('Requests/Response Tests', function() {
23
+ this.timeout(15000);
24
+ this.slow(5000);
25
+
26
+ it('Callback', function(done) {
27
+ prj.listProjects(function(err, data) {
28
+ assert.isNull(err)
29
+ assert.operator(data.Projects.length, '>', 0)
30
+ done()
31
+ })
32
+ })
33
+
34
+ it('Default Promise', function(done) {
35
+ var promise = prj.listProjects().promise()
36
+ promise.then(function(data) {
37
+ assert.operator(data.Projects.length, '>', 0)
38
+ done()
39
+ })
40
+ })
41
+
42
+ it('Custome Promise', function(done) {
43
+ prj.config.promiseDependency = BLUEBIRD
44
+ prj = new FX.Project(prj.config);
45
+
46
+ var promise = prj.listProjects().promise()
47
+ promise.then(function(data) {
48
+ assert.operator(data.Projects.length, '>', 0)
49
+ done()
50
+ })
51
+ })
52
+
53
+ it('Events', function(done) {
54
+ var req = prj.listProjects()
55
+ req.on('success', function(response){
56
+ assert.isNull(response.error)
57
+ assert.operator(response.data.Projects.length, '>', 0)
58
+ done()
59
+ })
60
+ req.send()
61
+ })
62
+ })
package/test/sdl.js ADDED
@@ -0,0 +1,125 @@
1
+ if(typeof window === 'undefined') {
2
+ assert = require('chai').assert;
3
+ FX = require('../lib/fx')
4
+ } else {
5
+ assert = chai.assert
6
+ }
7
+
8
+
9
+
10
+ var sdl = new FX.SDL()
11
+ var prj = new FX.Project({
12
+ apiVersion: '2016-06-02',
13
+ region: 'eu-west-1',
14
+ })
15
+
16
+ describe('SDL Tests', function() {
17
+ this.timeout(30000);
18
+ this.slow(5000);
19
+
20
+ var prjuid = null
21
+
22
+ it('Create Project', function(done) {
23
+ prj.createProject({Name: 'TestApi001'}, function(err, data){
24
+ assert.isNull(err)
25
+ assert.equal(data.Project.Name, "TestApi001")
26
+ prjuid = data.Project.ProjectId
27
+ console.log("Project: ", prjuid);
28
+ done();
29
+ })
30
+ })
31
+
32
+ if(!FX.util.isBrowser) {
33
+ var fs = require('fs')
34
+
35
+ it('Upload Asset', function(done) {
36
+ prj.uploadAsset({
37
+ ProjectId: prjuid,
38
+ Name: "circles.mp4",
39
+ Data: fs.createReadStream('test/circles.mp4')
40
+ }, function(err, data) {
41
+ assert.isNull(err)
42
+ done();
43
+ })
44
+ })
45
+ }
46
+
47
+
48
+ it('Create Movie', function(done) {
49
+ var movie = new sdl.Movie({
50
+ params: {
51
+ vparams: {
52
+ width: 640,
53
+ height: 360
54
+ }
55
+ }
56
+ })
57
+
58
+ if(!FX.util.isBrowser) {
59
+ movie.scenes.push( new sdl.Scene({
60
+ tracks: [{
61
+ content: {
62
+ type: "video",
63
+ source: {
64
+ path: "userdata/circles.mp4"
65
+ }
66
+ }
67
+ }]
68
+ }))
69
+ } else {
70
+ movie.scenes.push(new sdl.Scene({
71
+ tracks: [{
72
+ numframes: 100,
73
+ content: {type: "emptyimage"}
74
+ }]
75
+ }))
76
+ }
77
+
78
+ prj.createMovie({ProjectId: prjuid, Name: "simple", Movie: movie}, function(err, data) {
79
+ console.log(err);
80
+ assert.isNull(err)
81
+ assert.equal(data.Status, 201)
82
+ done();
83
+ })
84
+
85
+ })
86
+
87
+ it('Get Movie', function(done) {
88
+ prj.getMovie({ProjectId: prjuid, Name: "simple"}, function(err, data) {
89
+ assert.isNull(err)
90
+ assert.equal(data.Movie.params.vparams.width, 640)
91
+ assert.equal(data.Movie.params.vparams.height, 360)
92
+ done();
93
+ })
94
+ })
95
+
96
+ it('List Movies', function(done) {
97
+ prj.listMovies({ProjectId: prjuid}, function(err, data) {
98
+ assert.isNull(err)
99
+ assert.typeOf(data.Movies, 'array')
100
+
101
+ assert.equal(data.Movies.length, 1)
102
+ assert.equal(data.Movies[0].Name, "simple")
103
+ done();
104
+ })
105
+ })
106
+
107
+ it('Delete Movie', function(done) {
108
+
109
+ prj.deleteMovie({ProjectId: prjuid, Name: "simple"}, function(err, data){
110
+ assert.isNull(err)
111
+ assert.equal(data.Status, 200)
112
+ done();
113
+ })
114
+ })
115
+
116
+ it('Delete Project', function(done) {
117
+
118
+ prj.deleteProject({ProjectId: prjuid}, function(err, data){
119
+ assert.isNull(err)
120
+ assert.equal(data.Status, 201)
121
+ done();
122
+ })
123
+ })
124
+
125
+ })