Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
debomatic-webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
debomatic-webui-admins
debomatic-webui
Commits
79dd2046
Commit
79dd2046
authored
Jul 19, 2014
by
Leo Iannacone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start working on tests
parent
9e107afa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
173 additions
and
1 deletion
+173
-1
debomatic-webui/package.json
debomatic-webui/package.json
+2
-1
debomatic-webui/test/tests.coffee
debomatic-webui/test/tests.coffee
+133
-0
debomatic-webui/test/tests.config.coffee
debomatic-webui/test/tests.config.coffee
+38
-0
No files found.
debomatic-webui/package.json
View file @
79dd2046
...
...
@@ -14,7 +14,8 @@
},
"scripts"
:
{
"install"
:
"bash scripts/install.sh"
,
"start"
:
"coffee debomatic-webui"
"start"
:
"coffee debomatic-webui"
,
"test"
:
"cd test; mocha -R list --compilers coffee:coffee-script/register --require should tests.coffee"
},
"bin"
:
{
"debomatic-webui"
:
"./debomatic-webui"
...
...
debomatic-webui/test/tests.coffee
0 → 100644
View file @
79dd2046
fs
=
require
(
'fs'
)
path
=
require
(
'path'
)
spawn
=
require
(
'child_process'
).
spawn
exec
=
require
(
'child_process'
).
exec
config
=
require
(
'./tests.config'
)
io
=
require
(
'socket.io-client'
)
events
=
require
(
'../lib/config'
).
events
should
=
require
(
'should'
)
server
=
null
launch_server
=
()
->
server
=
spawn
(
'coffee'
,
[
'../debomatic-webui.coffee'
,
'-c'
,
'test/tests.config.coffee'
])
server
.
stdout
.
on
'data'
,
(
data
)
->
console
.
log
(
'
\n
SERVER OUT: '
,
data
.
toString
(
'utf-8'
))
server
.
stderr
.
on
'data'
,
(
data
)
->
console
.
error
(
'
\n
SERVER ERR'
,
data
.
toString
(
'utf-8'
))
server
.
on
'exit'
,
(
code
)
->
console
.
error
(
'child process exited with code '
+
code
);
process
.
exit
(
code
)
class
Helper
constructor
:
->
@
base
=
config
.
debomatic
.
path
@
json
=
config
.
debomatic
.
json
make_distribution
:
(
distribution
)
->
dpath
=
path
.
join
(
@
base
,
distribution
,
'pool'
)
exec
(
"mkdir -p
#{
dpath
}
"
)
make_package
:
(
distribution
,
debpack
)
->
dpath
=
path
.
join
(
@
base
,
distribution
,
'pool'
,
debpack
)
exec
(
"mkdir -p
#{
dpath
}
"
)
make_file
:
(
distribution
,
debpack
,
extension
,
data
)
->
file_path
=
path
.
join
(
@
base
,
distribution
,
'pool'
,
debpack
,
debpack
)
+
'.'
+
extension
@
make_package
(
distribution
,
debpack
)
exec
(
"echo
#{
data
}
>
#{
file_path
}
"
)
append_file
:
(
distribution
,
debpack
,
extension
,
data
)
->
file_path
=
path
.
join
(
@
base
,
distribution
,
'pool'
,
debpack
,
debpack
)
+
'.'
+
extension
@
make_package
(
distribution
,
debpack
)
exec
(
"echo
#{
data
}
>>
#{
file_path
}
"
)
append_json
:
(
data
)
->
exec
(
"echo
#{
data
}
>>
#{
@
json
}
"
)
clean
:
(
distribution
,
debpack
,
file_extension
)
->
b_path
=
@
base
b_path
=
path
.
join
(
b_path
,
distribution
,
'pool'
)
if
distribution
?
b_path
=
path
.
join
(
@
base
,
debpack
)
if
debpack
?
b_path
=
path
.
join
(
@
base
,
debpack
)
+
'.'
+
file_extension
if
file_extension
?
exec
(
"rm -r
#{
b_path
}
"
)
clean_all
:
()
->
exec
(
"rm -r
#{
@
base
}
/*"
)
exec
(
"rm -r
#{
@
json
}
"
)
get_query
:
(
distribution
,
debpack
,
file_extension
)
->
result
=
distribution
:
name
:
distribution
if
debpack
?
result
.
package
=
orig_name
:
debpack
name
:
debpack
.
split
(
'_'
)[
0
]
version
:
debpack
.
split
(
'_'
)[
1
]
if
file_extension
?
result
.
file
=
name
:
file_extension
return
result
helper
=
new
Helper
()
helper
.
make_distribution
(
'unstable'
)
# launch_server()
client
=
null
describe
'client'
,
->
before
(
(
done
)
->
helper
.
make_distribution
(
'trusty'
)
helper
.
make_distribution
(
'unstable'
)
helper
.
append_json
(
""
)
client
=
io
.
connect
(
"http://
#{
config
.
host
}
:
#{
config
.
port
}
"
)
done
()
)
it
'on getting distributions'
,
(
done
)
->
client
.
on
events
.
broadcast
.
distributions
,
(
data
)
->
data
.
should
.
be
.
eql
([
'trusty'
,
'unstable'
])
done
()
it
'on getting package list'
,
(
done
)
->
helper
.
make_file
(
'unstable'
,
'test_1.2.3'
,
'buildlog'
,
'test'
)
helper
.
make_file
(
'unstable'
,
'test_1.2.3'
,
'lintian'
,
'test'
)
client
.
emit
(
events
.
client
.
package_files_list
,
helper
.
get_query
(
'unstable'
,
'test_1.2.3'
))
client
.
on
events
.
client
.
package_files_list
,
(
data
)
->
data
.
distribution
.
name
.
should
.
be
.
eql
(
'unstable'
)
data
.
package
.
orig_name
.
should
.
be
.
eql
(
'test_1.2.3'
)
files_name
=
[]
for
f
in
data
.
package
.
files
files_name
.
push
(
f
.
name
)
files_name
.
should
.
be
.
eql
([
'buildlog'
,
'lintian'
])
done
()
it
'on getting file'
,
(
done
)
->
helper
.
make_file
(
'unstable'
,
'test_1.2.3'
,
'buildlog'
,
'this is a test'
)
client
.
emit
(
events
.
client
.
file
,
helper
.
get_query
(
'unstable'
,
'test_1.2.3'
,
'buildlog'
))
client
.
on
events
.
client
.
file
,
(
data
)
->
data
.
distribution
.
name
.
should
.
be
.
eql
(
'unstable'
)
data
.
package
.
orig_name
.
should
.
be
.
eql
(
'test_1.2.3'
)
data
.
file
.
name
.
should
.
be
.
eql
(
'buildlog'
)
data
.
file
.
content
.
should
.
be
.
eql
(
'this is a test
\n
'
)
done
()
it
'on getting file new content'
,
(
done
)
->
client
.
on
events
.
client
.
file_newcontent
,
(
data
)
->
data
.
distribution
.
name
.
should
.
be
.
eql
(
'unstable'
)
data
.
package
.
orig_name
.
should
.
be
.
eql
(
'test_1.2.3'
)
data
.
file
.
name
.
should
.
be
.
eql
(
'buildlog'
)
data
.
file
.
new_content
.
should
.
be
.
eql
(
'this is an appending test
\n
'
)
done
()
helper
.
append_file
(
'unstable'
,
'test_1.2.3'
,
'buildlog'
,
'this is an appending test'
)
after
(
()
->
helper
.
clean_all
()
)
# process.on 'exit', () ->
# server.kill()
debomatic-webui/test/tests.config.coffee
0 → 100644
View file @
79dd2046
###
debomatic-webui user configuration
###
###
Init some values, do not touch these
###
config
=
{}
config
.
debomatic
=
{}
config
.
web
=
{}
config
.
web
.
debomatic
=
{}
config
.
web
.
debomatic
.
admin
=
{}
config
.
web
.
debomatic
.
dput
=
{}
config
.
web
.
file
=
{}
config
.
web
.
preferences
=
{}
###
Configure host and port
###
config
.
host
=
"localhost"
config
.
port
=
3030
###
Deb-O-Matic settings
###
config
.
debomatic
.
path
=
"debomatic/dir"
config
.
debomatic
.
jsonfile
=
"debomatic/json.log"
###
List of files to get a simple preview and number of lines
to show
###
config
.
web
.
file
.
preview
=
[
"buildlog"
]
config
.
web
.
file
.
num_lines
=
25
# DO NOT EDIT THIS LINE:
module
.
exports
=
config
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment