Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Łukasz Nowak
slapos.core
Commits
8fe7ff08
Commit
8fe7ff08
authored
Aug 08, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Share one mixin.
parent
9ed94c78
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
36 deletions
+36
-36
slapos/tests/slapformat.py
slapos/tests/slapformat.py
+36
-36
No files found.
slapos/tests/slapformat.py
View file @
8fe7ff08
...
...
@@ -2,16 +2,6 @@ import logging
import
slapos.format
import
unittest
class
TestComputer
(
unittest
.
TestCase
):
def
test_getAddress_empty_computer
(
self
):
computer
=
slapos
.
format
.
Computer
(
'computer'
)
self
.
assertEqual
(
computer
.
getAddress
(),
{
'netmask'
:
None
,
'addr'
:
None
})
def
test_construct_empty
(
self
):
computer
=
slapos
.
format
.
Computer
(
'computer'
)
computer
.
construct
()
class
FakeConfig
:
pass
...
...
@@ -23,7 +13,20 @@ class TestLoggerHandler(logging.Handler):
def
emit
(
self
,
record
):
self
.
bucket
.
append
(
record
.
msg
)
class
TestPartition
(
unittest
.
TestCase
):
call_and_read_list
=
[]
def
fakeCallAndRead
(
argument_list
,
raise_on_error
=
True
):
global
call_and_read_list
call_and_read_list
.
append
(
argument_list
)
def
raising_KeyError
(
name
):
raise
KeyError
def
returning_True
(
name
):
return
True
class
FakeClass
:
pass
class
SlapformatMixin
(
unittest
.
TestCase
):
def
setUp
(
self
):
config
=
FakeConfig
()
config
.
dry_run
=
True
...
...
@@ -36,6 +39,27 @@ class TestPartition(unittest.TestCase):
self
.
partition
=
slapos
.
format
.
Partition
(
'partition'
,
'/part_path'
,
slapos
.
format
.
User
(
'root'
),
[],
None
)
self
.
partition
.
_os
=
slapos
.
format
.
OS
(
config
)
global
call_and_read_list
call_and_read_list
=
[]
self
.
real_callAndRead
=
slapos
.
format
.
callAndRead
slapos
.
format
.
callAndRead
=
fakeCallAndRead
def
tearDown
(
self
):
global
call_and_read_list
call_and_read_list
=
[]
slapos
.
format
.
callAndRead
=
self
.
real_callAndRead
class
TestComputer
(
SlapformatMixin
):
def
test_getAddress_empty_computer
(
self
):
computer
=
slapos
.
format
.
Computer
(
'computer'
)
self
.
assertEqual
(
computer
.
getAddress
(),
{
'netmask'
:
None
,
'addr'
:
None
})
def
test_construct_empty
(
self
):
computer
=
slapos
.
format
.
Computer
(
'computer'
)
computer
.
construct
()
class
TestPartition
(
SlapformatMixin
):
def
test_createPath
(
self
):
self
.
partition
.
createPath
()
...
...
@@ -58,31 +82,7 @@ class TestPartition(unittest.TestCase):
self
.
test_result
.
bucket
)
call_and_read_list
=
[]
def
fakeCallAndRead
(
argument_list
,
raise_on_error
=
True
):
global
call_and_read_list
call_and_read_list
.
append
(
argument_list
)
def
raising_KeyError
(
name
):
raise
KeyError
def
returning_True
(
name
):
return
True
class
FakeClass
:
pass
class
TestUser
(
unittest
.
TestCase
):
def
setUp
(
self
):
global
call_and_read_list
call_and_read_list
=
[]
self
.
real_callAndRead
=
slapos
.
format
.
callAndRead
slapos
.
format
.
callAndRead
=
fakeCallAndRead
def
tearDown
(
self
):
global
call_and_read_list
call_and_read_list
=
[]
slapos
.
format
.
callAndRead
=
self
.
real_callAndRead
class
TestUser
(
SlapformatMixin
):
def
test_create
(
self
):
global
call_and_read_list
user
=
slapos
.
format
.
User
(
'testuser'
)
...
...
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